Documentation ¶
Index ¶
- Constants
- type PostgresRepository
- type Session
- type SessionRepository
- type User
- type UserRepository
- func (r *UserRepository) Create(ctx context.Context, user domain.User) error
- func (r *UserRepository) ForgotPassword(ctx context.Context, password, email string) error
- func (r *UserRepository) GetByID(ctx context.Context, id ksuid.KSUID) (domain.User, error)
- func (r *UserRepository) GetByUsername(ctx context.Context, username string) (domain.User, error)
- func (r *UserRepository) UpdateAvatar(ctx context.Context, avatarUrl string, id ksuid.KSUID) error
Constants ¶
View Source
const SessionTable string = "user_session"
Session table name.
View Source
const UserTable string = "user"
User table name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresRepository ¶
Postgres repository structure.
func NewPostgresRepository ¶
func NewPostgresRepository(cfg config.PostgresConfig) *PostgresRepository
Creating a new postgres repository.
type Session ¶
type Session interface { Create(ctx context.Context, session domain.Session) error GetUserId(ctx context.Context, refreshToken, ip string) (ksuid.KSUID, error) Delete(ctx context.Context, refreshToken, ip string) error }
User session repository interface.
type SessionRepository ¶
type SessionRepository struct {
// contains filtered or unexported fields
}
User session repository structure.
func NewSessionRepository ¶
func NewSessionRepository(psql postgres.Postgres) *SessionRepository
Creating a new user session repository.
type User ¶
type User interface { Create(ctx context.Context, user domain.User) error GetByID(ctx context.Context, id ksuid.KSUID) (domain.User, error) GetByUsername(ctx context.Context, username string) (domain.User, error) ForgotPassword(ctx context.Context, password, email string) error UpdateAvatar(ctx context.Context, avatarUrl string, id ksuid.KSUID) error }
User repository interface.
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
User repository structure.
func NewUserRepository ¶
func NewUserRepository(psql postgres.Postgres) *UserRepository
Creating a new user repository.
func (*UserRepository) ForgotPassword ¶
func (r *UserRepository) ForgotPassword(ctx context.Context, password, email string) error
Forgot password in postgres database.
func (*UserRepository) GetByUsername ¶
Get user by username in postgres database.
func (*UserRepository) UpdateAvatar ¶
Update user avatar in postgres database.
Click to show internal directories.
Click to hide internal directories.