Documentation ¶
Overview ¶
Package repo is an implements app.UserRepo.
Index ¶
- func Connect(ctx context.Context, options ...Option) (*sql.DB, error)
- func InitMetrics(namespace string)
- type Option
- type Repo
- func (repo *Repo) Close() error
- func (repo *Repo) Code(ctx context.Context, id app.UserID) (code string, err error)
- func (repo *Repo) CreateUser(ctx context.Context, newUser app.User) (userID app.UserID, err error)
- func (repo *Repo) DeleteSession(ctx context.Context, tokenID app.TokenID) error
- func (repo *Repo) DeleteTaskNotification(ctx context.Context, id int) error
- func (repo *Repo) DeleteUser(ctx context.Context, userID app.UserID) error
- func (repo *Repo) ListUserByUsername(ctx context.Context, username string, page app.Page) (users []app.User, total int, err error)
- func (repo *Repo) NotificationTask(ctx context.Context) (task *app.TaskNotification, err error)
- func (repo *Repo) SaveCode(ctx context.Context, userID app.UserID, code string) error
- func (repo *Repo) SaveSession(ctx context.Context, userID app.UserID, tokenID app.TokenID, origin app.Origin) error
- func (repo *Repo) SessionByTokenID(ctx context.Context, tokenID app.TokenID) (session *app.Session, err error)
- func (repo *Repo) UpdateEmail(ctx context.Context, userID app.UserID, email string) error
- func (repo *Repo) UpdatePassword(ctx context.Context, userID app.UserID, passHash []byte) error
- func (repo *Repo) UpdateUsername(ctx context.Context, userID app.UserID, username string) error
- func (repo *Repo) UserByEmail(ctx context.Context, email string) (user *app.User, err error)
- func (repo *Repo) UserByID(ctx context.Context, userID app.UserID) (user *app.User, err error)
- func (repo *Repo) UserByTokenID(ctx context.Context, token app.TokenID) (user *app.User, err error)
- func (repo *Repo) UserByUsername(ctx context.Context, username string) (user *app.User, err error)
- func (repo *Repo) UserID(ctx context.Context, code string) (userID app.UserID, createAt time.Time, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitMetrics ¶
func InitMetrics(namespace string)
InitMetrics must be called once before using this package. It registers and initializes metrics used by this package.
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is an implements app.UserRepo. Responsible for working with database.
func (*Repo) CreateUser ¶
CreateUser need for implements app.UserRepo.
func (*Repo) DeleteSession ¶
DeleteSession need for implements app.SessionRepo.
func (*Repo) DeleteTaskNotification ¶
DeleteTaskNotification need for implements app.WAL.
func (*Repo) DeleteUser ¶
DeleteUser need for implements app.UserRepo.
func (*Repo) ListUserByUsername ¶
func (repo *Repo) ListUserByUsername(ctx context.Context, username string, page app.Page) (users []app.User, total int, err error)
ListUserByUsername need for implements app.UserRepo.
func (*Repo) NotificationTask ¶
NotificationTask need for implements app.WAL.
func (*Repo) SaveSession ¶
func (repo *Repo) SaveSession(ctx context.Context, userID app.UserID, tokenID app.TokenID, origin app.Origin) error
SaveSession need for implements app.SessionRepo.
func (*Repo) SessionByTokenID ¶
func (repo *Repo) SessionByTokenID(ctx context.Context, tokenID app.TokenID) (session *app.Session, err error)
SessionByTokenID need for implements app.SessionRepo.
func (*Repo) UpdateEmail ¶
UpdateEmail need for implements app.UserRepo.
func (*Repo) UpdatePassword ¶
UpdatePassword need for implements app.UserRepo.
func (*Repo) UpdateUsername ¶
UpdateUsername need for implements app.UserRepo.
func (*Repo) UserByEmail ¶
UserByEmail need for implements app.UserRepo.
func (*Repo) UserByTokenID ¶
UserByTokenID need for implements app.UserRepo.
func (*Repo) UserByUsername ¶
UserByUsername need for implements app.UserRepo.