Documentation ¶
Overview ¶
Package user provides an implementation of the UserService UserService uses a backend.NoSQLDatabase to store user data
Index ¶
- type User
- type UserService
- type UserServiceImpl
- func (u *UserServiceImpl) DeleteUser(ctx context.Context, userID string) error
- func (u *UserServiceImpl) FindByUserID(ctx context.Context, userID string) (User, error)
- func (u *UserServiceImpl) FindByUsername(ctx context.Context, username string) (User, error)
- func (u *UserServiceImpl) GetAllUsers(ctx context.Context) ([]User, error)
- func (u *UserServiceImpl) SaveUser(ctx context.Context, user User) error
- func (u *UserServiceImpl) UpdateUser(ctx context.Context, user User) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserService ¶
type UserService interface { // Finds a user given `username` FindByUsername(ctx context.Context, username string) (User, error) // Finds a user ID given `userID` FindByUserID(ctx context.Context, userID string) (User, error) // Deletes a user with ID `userID` DeleteUser(ctx context.Context, userID string) error // Gets all users GetAllUsers(ctx context.Context) ([]User, error) // Saves a new user SaveUser(ctx context.Context, user User) error // Updates an existing user UpdateUser(ctx context.Context, user User) (bool, error) }
UserService manages the users in the application
type UserServiceImpl ¶
type UserServiceImpl struct {
// contains filtered or unexported fields
}
Implementation of UserService
func NewUserServiceImpl ¶
func NewUserServiceImpl(ctx context.Context, db backend.NoSQLDatabase) (*UserServiceImpl, error)
Creates and returns a UserService object
func (*UserServiceImpl) DeleteUser ¶
func (u *UserServiceImpl) DeleteUser(ctx context.Context, userID string) error
func (*UserServiceImpl) FindByUserID ¶
func (*UserServiceImpl) FindByUsername ¶
func (*UserServiceImpl) GetAllUsers ¶
func (u *UserServiceImpl) GetAllUsers(ctx context.Context) ([]User, error)
func (*UserServiceImpl) SaveUser ¶
func (u *UserServiceImpl) SaveUser(ctx context.Context, user User) error
func (*UserServiceImpl) UpdateUser ¶
Click to show internal directories.
Click to hide internal directories.