Documentation ¶
Index ¶
- Variables
- type MockUsers
- func (mp *MockUsers) AddUser(ctx context.Context, user *data.User) error
- func (mp *MockUsers) CloseDB()
- func (mp *MockUsers) Connect() error
- func (mp *MockUsers) DeleteUser(ctx context.Context, id string) error
- func (mp *MockUsers) GetUserByID(ctx context.Context, id string) (*data.User, error)
- func (mp *MockUsers) GetUserByUsername(ctx context.Context, username string) (*data.User, error)
- func (mp *MockUsers) GetUsers(ctx context.Context) data.Users
- func (mp *MockUsers) PingDB() error
- func (mp *MockUsers) UpdateUser(ctx context.Context, user *data.User) error
- type MongoUsers
- func (mp *MongoUsers) AddUser(ctx context.Context, User *data.User) error
- func (mp *MongoUsers) CloseDB()
- func (mp *MongoUsers) Connect() error
- func (mp *MongoUsers) DeleteUser(ctx context.Context, id string) error
- func (mp *MongoUsers) GetUserByID(ctx context.Context, id string) (*data.User, error)
- func (mp *MongoUsers) GetUserByUsername(ctx context.Context, username string) (*data.User, error)
- func (mp *MongoUsers) GetUsers(ctx context.Context) data.Users
- func (mp *MongoUsers) PingDB() error
- func (mp *MongoUsers) UpdateUser(ctx context.Context, User *data.User) error
- type UserDB
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorEnvVar = fmt.Errorf("missing environment variable")
ErrorEnvVar : Environment variable error
Functions ¶
This section is empty.
Types ¶
type MockUsers ¶
type MockUsers struct { }
func (*MockUsers) DeleteUser ¶
DeleteUser deletes the user with the given id
func (*MockUsers) GetUserByID ¶
GetUserByID returns a single user with the given id
func (*MockUsers) GetUserByUsername ¶
GetUserByUsername returns a single user with the given id
type MongoUsers ¶
type MongoUsers struct {
// contains filtered or unexported fields
}
func (*MongoUsers) CloseDB ¶
func (mp *MongoUsers) CloseDB()
func (*MongoUsers) Connect ¶
func (mp *MongoUsers) Connect() error
func (*MongoUsers) DeleteUser ¶
func (mp *MongoUsers) DeleteUser(ctx context.Context, id string) error
func (*MongoUsers) GetUserByID ¶
func (*MongoUsers) GetUserByUsername ¶
func (*MongoUsers) PingDB ¶
func (mp *MongoUsers) PingDB() error
func (*MongoUsers) UpdateUser ¶
type UserDB ¶
type UserDB interface { GetUsers(ctx context.Context) data.Users GetUserByID(ctx context.Context, id string) (*data.User, error) GetUserByUsername(ctx context.Context, username string) (*data.User, error) UpdateUser(ctx context.Context, user *data.User) error AddUser(ctx context.Context, user *data.User) error DeleteUser(ctx context.Context, id string) error Connect() error PingDB() error CloseDB() }
The interface that any kind of database must implement
func NewMockUsers ¶
func NewMockUsers() UserDB
func NewMongoUsers ¶
func NewMongoUsers() UserDB
Click to show internal directories.
Click to hide internal directories.