Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id" json:"id,omitempty"` FirstName string `json:"first_name"` LastName string `json:"last_name"` UserName string `json:"username"` Password string `json:"password"` }
User represents a user of the system
func GetUserByUserName ¶
GetUserByUserName returns the user record matching privided ID
type UserAuthentication ¶
type UserAuthentication struct { UUID string `json:"uuid" form:"-"` Username string `json:"username" form:"username"` Password string `json:"password" form:"password"` }
UserAuthentication is used to authenticate the user and pass JWT to client
type UserCollection ¶
type UserCollection struct {
Users []User
}
UserCollection is a collection of user records
var Users UserCollection
Users is a package level variable acting as an in-memory user database
func (UserCollection) AllUsers ¶
func (uc UserCollection) AllUsers() (*UserCollection, error)
AllUsers is a public method to return all the user details from the database
func (UserCollection) CreateUser ¶
func (uc UserCollection) CreateUser(user *User) (*User, error)
CreateUser is a public method to create new user in the database
func (UserCollection) DeleteUserByID ¶
func (uc UserCollection) DeleteUserByID(id string) (string, error)
DeleteUserByID is a public method to remove tge user record matching privided ID
func (UserCollection) GetUserByID ¶
func (uc UserCollection) GetUserByID(id string) (*User, error)
GetUserByID returns the user record matching privided ID
Click to show internal directories.
Click to hide internal directories.