Documentation ¶
Overview ¶
Package repo contains wrapper for database abstraction.
Index ¶
- type Config
- type Repo
- func (r *Repo) Close() error
- func (r *Repo) DeleteAvatar(ctx context.Context, userID, avatarID uuid.UUID) error
- func (r *Repo) FinishTask(ctx context.Context, id uuid.UUID) error
- func (r *Repo) GetAvatar(ctx context.Context, avatarID uuid.UUID) (f *app.AvatarInfo, err error)
- func (r *Repo) GetCountAvatars(ctx context.Context, ownerID uuid.UUID) (total int, err error)
- func (r *Repo) Health(ctx context.Context) error
- func (r *Repo) ListActualTask(ctx context.Context, limit int) (tasks []app.Task, err error)
- func (r *Repo) ListAvatarByUserID(ctx context.Context, userID uuid.UUID) (userAvatars []app.AvatarInfo, err error)
- func (r *Repo) SaveAvatar(ctx context.Context, userFile app.AvatarInfo) (err error)
- func (r *Repo) SaveTask(ctx context.Context, task app.Task) (id uuid.UUID, err error)
- func (r *Repo) SearchUsers(ctx context.Context, params app.SearchParams) (users []app.User, total int, err error)
- func (r *Repo) SessionByID(ctx context.Context, sessionID uuid.UUID) (s *app.Session, err error)
- func (r *Repo) SessionDelete(ctx context.Context, sessionID uuid.UUID) error
- func (r *Repo) SessionSave(ctx context.Context, session app.Session) error
- func (r *Repo) Tx(ctx context.Context, f func(app.Repo) error) error
- func (r *Repo) UserByEmail(ctx context.Context, email string) (u *app.User, err error)
- func (r *Repo) UserByID(ctx context.Context, id uuid.UUID) (u *app.User, err error)
- func (r *Repo) UserByUsername(ctx context.Context, username string) (u *app.User, err error)
- func (r *Repo) UserDelete(ctx context.Context, id uuid.UUID) error
- func (r *Repo) UserSave(ctx context.Context, u app.User) (id uuid.UUID, err error)
- func (r *Repo) UserUpdate(ctx context.Context, u app.User) (upUser *app.User, err error)
- func (r *Repo) UsersByIDs(ctx context.Context, ids []uuid.UUID) (users []app.User, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Postgres connectors.Raw MigrateDir string Driver string }
Config provide connection info for database.
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo provided data from and to database.
func New ¶
func New(ctx context.Context, reg *prometheus.Registry, namespace string, cfg Config) (*Repo, error)
New build and returns user db.
func (*Repo) DeleteAvatar ¶
DeleteAvatar for implements app.Repo.
func (*Repo) FinishTask ¶
FinishTask implements app.Repo.
func (*Repo) GetCountAvatars ¶
GetCountAvatars for implements app.Repo.
func (*Repo) ListActualTask ¶
ListActualTask implements app.Repo.
func (*Repo) ListAvatarByUserID ¶
func (r *Repo) ListAvatarByUserID(ctx context.Context, userID uuid.UUID) (userAvatars []app.AvatarInfo, err error)
ListAvatarByUserID for implements app.Repo.
func (*Repo) SaveAvatar ¶
SaveAvatar for implements app.Repo.
func (*Repo) SearchUsers ¶
func (r *Repo) SearchUsers(ctx context.Context, params app.SearchParams) (users []app.User, total int, err error)
SearchUsers for implements app.Repo.
func (*Repo) SessionByID ¶
SessionByID for implements app.Repo.
func (*Repo) SessionDelete ¶
SessionDelete for implements app.Repo.
func (*Repo) SessionSave ¶
SessionSave for implements app.Repo.
func (*Repo) UserByEmail ¶
UserByEmail for implements app.Repo.
func (*Repo) UserByUsername ¶
UserByUsername for implements app.Repo.
func (*Repo) UserDelete ¶
UserDelete for implements app.Repo.
func (*Repo) UserUpdate ¶
UserUpdate for implements app.Repo.