Documentation ¶
Overview ¶
Package user implements a basic user management system.
Index ¶
- Variables
- type FirebaseManager
- func (m FirebaseManager) Add(ctx context.Context, usr User) (<-chan *User, <-chan error)
- func (m FirebaseManager) ConfirmExists(ctx context.Context, user User) <-chan errordeprecated
- func (m FirebaseManager) Find(ctx context.Context, query datastore.Query) (<-chan (<-chan *User), <-chan error)
- func (m FirebaseManager) Update(ctx context.Context, user User) (<-chan *User, <-chan error)
- type Manager
- type User
Constants ¶
This section is empty.
Variables ¶
var ( ErrUserDuplicate = errors.New("duplicate user") ErrUserNotFound = errors.New("user not found") )
Errors.
Functions ¶
This section is empty.
Types ¶
type FirebaseManager ¶
type FirebaseManager struct {
// contains filtered or unexported fields
}
FirebaseManager is responsible for all user related operations
func NewFirebaseManager ¶
func NewFirebaseManager(client *firestore.Client, collectionName string) FirebaseManager
NewFirebaseManager creates a new UserManager with the given firestore client and collection name.
func (FirebaseManager) Add ¶
Add adds a user to the database of users.
Please note that Add will return ErrUserDuplicate if the user already exists in the datastore.
func (FirebaseManager) ConfirmExists
deprecated
func (m FirebaseManager) ConfirmExists(ctx context.Context, user User) <-chan error
ConfirmExists looks for the user with the given username and password.
This function will return ErrUserNotFound in the case where a user matching the given user cannot be found.
Deprecated: use Find instead
type Manager ¶
type Manager interface { // Add adds a user to the database of users. // // Add will return ErrUserDuplicate if the user already exists in the // datastore. Add(ctx context.Context, user User) (<-chan *User, <-chan error) // Find finds the user based on the given query criteron Find(ctx context.Context, query datastore.Query) (<-chan (<-chan *User), <-chan error) // Update updates the given user record. // // Update will return ErrUserNotFound if the user cannot be found in the // underlying datastore Update(ctx context.Context, user User) (<-chan *User, <-chan error) }
Manager is responsible for all user related operations.
Depending on how users are stored and queried, there could be multiple implementations of the Manager interface.