Documentation ¶
Index ¶
- Constants
- Variables
- func Setup(ctx context.Context, db *mongo.Database) error
- func UserUpdate(ctx context.Context, db *mongo.Database, id schema.ID, signature []byte, ...) error
- type User
- type UserFilter
- func (f UserFilter) Count(ctx context.Context, db *mongo.Database) (int64, error)
- func (f UserFilter) Find(ctx context.Context, db *mongo.Database, opts ...*options.FindOptions) (*mongo.Cursor, error)
- func (f UserFilter) Get(ctx context.Context, db *mongo.Database) (user User, err error)
- func (f UserFilter) WithEmail(email string) UserFilter
- func (f UserFilter) WithID(id schema.ID) UserFilter
- func (f UserFilter) WithName(name string) UserFilter
Constants ¶
View Source
const (
// UserCollection db collection name
UserCollection = "user"
)
Variables ¶
View Source
var ( // ErrUserExists returned if user with same name exists ErrUserExists = errors.New("user with same name or email exists") // ErrUserNotFound is returned if user is not found ErrUserNotFound = errors.New("user not found") // ErrBadUserUpdate is returned when invalid data is passed to update ErrBadUserUpdate = errors.New("bad data during user update") // ErrAuthorization returned if user is not allowed to do an operation ErrAuthorization = errors.New("operation not allowed") )
Functions ¶
Types ¶
type User ¶
User type
type UserFilter ¶
UserFilter type
func (UserFilter) Find ¶
func (f UserFilter) Find(ctx context.Context, db *mongo.Database, opts ...*options.FindOptions) (*mongo.Cursor, error)
Find all users that matches filter
func (UserFilter) WithEmail ¶
func (f UserFilter) WithEmail(email string) UserFilter
WithEmail filters user with email
func (UserFilter) WithID ¶
func (f UserFilter) WithID(id schema.ID) UserFilter
WithID filters user with ID
func (UserFilter) WithName ¶
func (f UserFilter) WithName(name string) UserFilter
WithName filters user with name
Click to show internal directories.
Click to hide internal directories.