Documentation ¶
Index ¶
- func Cleanup(t *testing.T, database db.DB)
- func Setup(t *testing.T) db.DB
- type ByID
- type InMemoryDB
- func (database *InMemoryDB) Close() error
- func (database *InMemoryDB) CreateUser(_ context.Context, user *domain.User) (int, error)
- func (database *InMemoryDB) Ping(ctx context.Context) error
- func (database *InMemoryDB) ReadUserByID(_ context.Context, id int) (*domain.User, error)
- func (database *InMemoryDB) ReadUsers(_ context.Context) ([]*domain.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type InMemoryDB ¶
type InMemoryDB struct {
// contains filtered or unexported fields
}
InMemoryDB is an in-memory implementation of DB. This is mainly useful for testing.
func (*InMemoryDB) Close ¶
func (database *InMemoryDB) Close() error
Close is a no-op, but present so that we implement the DB interface.
func (*InMemoryDB) CreateUser ¶
CreateUser stores the provided user.
func (*InMemoryDB) Ping ¶
func (database *InMemoryDB) Ping(ctx context.Context) error
Ping ensures this database client can reach the database.
func (*InMemoryDB) ReadUserByID ¶
ReadUserByID return the stored user corresponding to the provided ID.
Click to show internal directories.
Click to hide internal directories.