// rqliteDao implements the Daoer interface for interacting with an rqlite database.
type rqliteDao struct {
conn *gorqlite.Connection
}
// NewRQLiteDao creates a new instance of rqliteDao.
func NewRQLiteDao() (Daoer, error) {
// Connect to rqlite cluster
conn, err := gorqlite.Open(os.Getenv("RQLITE_DB"))
if err != nil {
return nil, err
}
return &rqliteDao{
conn: conn,
}, nil
}
This is my original connection to connect to rqlite db.
How do I mock this connection to use something like this
// mock the database
// Create a new rqliteDao instance with the mock connection
dao := &rqliteDao{conn: mockConn}
and run the functionality tests like dao.functions
mocking is not working