repo

package
v0.0.0-...-4f8386e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package repo contains wrapper for database abstraction.

Index

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) Close

func (r *Repo) Close() error

Close implements io.Closer.

func (*Repo) DeleteAvatar

func (r *Repo) DeleteAvatar(ctx context.Context, userID, avatarID uuid.UUID) error

DeleteAvatar for implements app.Repo.

func (*Repo) FinishTask

func (r *Repo) FinishTask(ctx context.Context, id uuid.UUID) error

FinishTask implements app.Repo.

func (*Repo) GetAvatar

func (r *Repo) GetAvatar(ctx context.Context, avatarID uuid.UUID) (f *app.AvatarInfo, err error)

GetAvatar for implements app.Repo.

func (*Repo) GetCountAvatars

func (r *Repo) GetCountAvatars(ctx context.Context, ownerID uuid.UUID) (total int, err error)

GetCountAvatars for implements app.Repo.

func (*Repo) Health

func (r *Repo) Health(ctx context.Context) error

Health check database connection.

func (*Repo) ListActualTask

func (r *Repo) ListActualTask(ctx context.Context, limit int) (tasks []app.Task, err error)

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

func (r *Repo) SaveAvatar(ctx context.Context, userFile app.AvatarInfo) (err error)

SaveAvatar for implements app.Repo.

func (*Repo) SaveTask

func (r *Repo) SaveTask(ctx context.Context, task app.Task) (id uuid.UUID, err error)

SaveTask 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

func (r *Repo) SessionByID(ctx context.Context, sessionID uuid.UUID) (s *app.Session, err error)

SessionByID for implements app.Repo.

func (*Repo) SessionDelete

func (r *Repo) SessionDelete(ctx context.Context, sessionID uuid.UUID) error

SessionDelete for implements app.Repo.

func (*Repo) SessionSave

func (r *Repo) SessionSave(ctx context.Context, session app.Session) error

SessionSave for implements app.Repo.

func (*Repo) Tx

func (r *Repo) Tx(ctx context.Context, f func(app.Repo) error) error

Tx implements app.Repo.

func (*Repo) UserByEmail

func (r *Repo) UserByEmail(ctx context.Context, email string) (u *app.User, err error)

UserByEmail for implements app.Repo.

func (*Repo) UserByID

func (r *Repo) UserByID(ctx context.Context, id uuid.UUID) (u *app.User, err error)

UserByID for implements app.Repo.

func (*Repo) UserByUsername

func (r *Repo) UserByUsername(ctx context.Context, username string) (u *app.User, err error)

UserByUsername for implements app.Repo.

func (*Repo) UserDelete

func (r *Repo) UserDelete(ctx context.Context, id uuid.UUID) error

UserDelete for implements app.Repo.

func (*Repo) UserSave

func (r *Repo) UserSave(ctx context.Context, u app.User) (id uuid.UUID, err error)

UserSave for implements app.Repo.

func (*Repo) UserUpdate

func (r *Repo) UserUpdate(ctx context.Context, u app.User) (upUser *app.User, err error)

UserUpdate for implements app.Repo.

func (*Repo) UsersByIDs

func (r *Repo) UsersByIDs(ctx context.Context, ids []uuid.UUID) (users []app.User, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL