Documentation ¶
Overview ¶
Package store contains the components necessary for api services to interact with the database
Index ¶
- Variables
- type UserDBClient
- func (u *UserDBClient) Create(db *gorm.DB, user models.User) (*models.User, error)
- func (u *UserDBClient) Delete(db *gorm.DB, user *models.User) error
- func (u *UserDBClient) FindByToken(db *gorm.DB, token string) (*models.User, error)
- func (u *UserDBClient) FindByUsername(db *gorm.DB, uname string) (*models.User, error)
- func (u *UserDBClient) List(db *gorm.DB, qp *models.ListQuery, p *models.Pagination) ([]models.User, error)
- func (u *UserDBClient) Update(db *gorm.DB, user *models.User) error
- func (u *UserDBClient) View(db *gorm.DB, id uint) (*models.User, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAlreadyExists = echo.NewHTTPError(http.StatusBadRequest, "username or email already exists") ErrRecordNotFound = echo.NewHTTPError(http.StatusNotFound, "user not found") )
Custom errors
Functions ¶
This section is empty.
Types ¶
type UserDBClient ¶
type UserDBClient struct{}
UserDBClient represents the client for user table
func NewUserDBClient ¶
func NewUserDBClient() *UserDBClient
NewUserDBClient returns a new user client for db interface
func (*UserDBClient) FindByToken ¶
FindByToken queries for single user by token
func (*UserDBClient) FindByUsername ¶
FindByUsername queries for single user by username
func (*UserDBClient) List ¶
func (u *UserDBClient) List(db *gorm.DB, qp *models.ListQuery, p *models.Pagination) ([]models.User, error)
List returns list of all users retrievable for the current user, depending on role
Click to show internal directories.
Click to hide internal directories.