Documentation ¶
Overview ¶
Package repo contains implementations of the repository interfaces
Index ¶
- Variables
- type PG
- func (pg *PG) DeleteGarden(ctx context.Context, gardenID int64) error
- func (pg *PG) DeleteUserPlant(ctx context.Context, userPlantID int64) error
- func (pg *PG) FindGardenByID(ctx context.Context, gardenID int64) (*models.Garden, error)
- func (pg *PG) FindUserByLogin(ctx context.Context, login string) (*models.User, []byte, error)
- func (pg *PG) GetRefPlantByID(ctx context.Context, id int64) (*models.RefPlant, error)
- func (pg *PG) GetRefPlants(ctx context.Context, params refplant.GetRefPlantsParams) ([]*models.RefPlant, int64, int64, error)
- func (pg *PG) GetUserPlantByID(ctx context.Context, userPlantID int64) (*models.UserPlant, error)
- func (pg *PG) Health(ctx context.Context) error
- func (pg *PG) ListGarden(ctx context.Context, garden *models.Garden) ([]models.Garden, error)
- func (pg *PG) ListUserPlants(ctx context.Context, userID, limit, offset int64) ([]*models.UserPlant, error)
- func (pg *PG) StoreGarden(ctx context.Context, garden *models.Garden) (*models.Garden, error)
- func (pg *PG) StorePlant(ctx context.Context, plant *models.UserPlant) (*models.UserPlant, error)
- func (pg *PG) StoreUser(ctx context.Context, user *models.User, passwordHash []byte) (*models.User, error)
- func (pg *PG) UpdateUserPlant(ctx context.Context, plant *models.UserPlant) (*models.UserPlant, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound error = errors.New("user not found")
ErrNotFound user not found.
Functions ¶
This section is empty.
Types ¶
type PG ¶
type PG struct {
// contains filtered or unexported fields
}
PG ...
func (*PG) DeleteGarden ¶
DeleteGarden deletes garden from db by specified id.
func (*PG) DeleteUserPlant ¶
DeleteUserPlant delete user's plant by id.
func (*PG) FindGardenByID ¶
FindGardenByID extracts garden from db by specified id.
func (*PG) FindUserByLogin ¶
FindUserByLogin extracts user from db by specified username.
func (*PG) GetRefPlantByID ¶
GetRefPlantByID extracts reference.plant by specified id.
func (*PG) GetRefPlants ¶
func (pg *PG) GetRefPlants(ctx context.Context, params refplant.GetRefPlantsParams) ([]*models.RefPlant, int64, int64, error)
GetRefPlans extracts all plants from the reference by parameters.
func (*PG) GetUserPlantByID ¶
GetUserPlantByID get user's plant by id from db.
func (*PG) ListGarden ¶
ListGarden shows a list of user's gardens.
func (*PG) ListUserPlants ¶
func (pg *PG) ListUserPlants(ctx context.Context, userID, limit, offset int64) ([]*models.UserPlant, error)
ListUserPlants get all user's plants from db.
func (*PG) StoreGarden ¶
StoreGarden inserts new garden to public.gardens.
func (*PG) StorePlant ¶
StorePlant create new user's plant.