Documentation ¶
Overview ¶
Package user implements a basic user management system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
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.
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.
Click to show internal directories.
Click to hide internal directories.