Documentation
¶
Index ¶
- type PostgresInterface
- func (p *PostgresInterface) BanUser(ctx context.Context, bannedId uuid.UUID, bannedBy uuid.UUID) error
- func (p *PostgresInterface) ChangeDisplayedName(ctx context.Context, uID uuid.UUID, newName string) error
- func (p *PostgresInterface) ChangeLogin(ctx context.Context, uID uuid.UUID, newLogin string) error
- func (p *PostgresInterface) ChangePassword(ctx context.Context, uID uuid.UUID, newPassowrd string) error
- func (p *PostgresInterface) GetAllAdmins(ctx context.Context) ([]entities.UserWithoutLogin, error)
- func (p *PostgresInterface) GetBannedByUserID(ctx context.Context, uID uuid.UUID) ([]entities.UserWithoutLogin, error)
- func (p *PostgresInterface) GetByWhoBannedUserID(ctx context.Context, uID uuid.UUID) error
- func (p *PostgresInterface) GetCountOfUsers(ctx context.Context) (int, error)
- func (p *PostgresInterface) GetFreeUsernameId(ctx context.Context, username string) (int, error)
- func (p *PostgresInterface) GetIdByUsername(ctx context.Context, uname username.Username) (uuid.UUID, error)
- func (p *PostgresInterface) GetUserByID(ctx context.Context, id uuid.UUID) (entities.User, error)
- func (p *PostgresInterface) GetUserIdByLogin(ctx context.Context, login string) (uuid.UUID, error)
- func (p *PostgresInterface) GetUsernameByID(ctx context.Context, uID uuid.UUID) (username.Username, error)
- func (p *PostgresInterface) IsAdmin(ctx context.Context, uID uuid.UUID) (bool, error)
- func (p *PostgresInterface) IsBanned(ctx context.Context, bannedId uuid.UUID, bannedById uuid.UUID) (bool, error)
- func (p *PostgresInterface) IsLoginTaken(ctx context.Context, login string) (bool, error)
- func (p *PostgresInterface) MakeAdmin(ctx context.Context, uID uuid.UUID) error
- func (p *PostgresInterface) RemoveUser(ctx context.Context, id uuid.UUID) error
- func (p *PostgresInterface) SaveUser(ctx context.Context, user entities.UserCreationOpts) (uuid.UUID, error)
- func (p *PostgresInterface) SetNilUsername(ctx context.Context, uID uuid.UUID) error
- func (p *PostgresInterface) SetUsername(ctx context.Context, uID uuid.UUID, username string) error
- func (p *PostgresInterface) UnbanUser(ctx context.Context, bannedId uuid.UUID, bannedBy uuid.UUID) error
- func (p *PostgresInterface) VerifyIdAndPassword(ctx context.Context, uid uuid.UUID, password string) (bool, error)
- func (p *PostgresInterface) VerifyLoginCreds(ctx context.Context, creds entities.Creds) (uuid.UUID, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresInterface ¶
type PostgresInterface struct {
// contains filtered or unexported fields
}
func NewPostrgerInterface ¶
func NewPostrgerInterface(pool *pgxpool.Pool) *PostgresInterface
func (*PostgresInterface) BanUser ¶
func (p *PostgresInterface) BanUser(ctx context.Context, bannedId uuid.UUID, bannedBy uuid.UUID) error
Add user to the blocklist
func (*PostgresInterface) ChangeDisplayedName ¶
func (*PostgresInterface) ChangeLogin ¶
func (*PostgresInterface) ChangePassword ¶
func (*PostgresInterface) GetAllAdmins ¶
func (p *PostgresInterface) GetAllAdmins(ctx context.Context) ([]entities.UserWithoutLogin, error)
func (*PostgresInterface) GetBannedByUserID ¶
func (p *PostgresInterface) GetBannedByUserID(ctx context.Context, uID uuid.UUID) ([]entities.UserWithoutLogin, error)
TODO: Scan data into the structure
func (*PostgresInterface) GetByWhoBannedUserID ¶
TODO: Scan data into the structure
func (*PostgresInterface) GetCountOfUsers ¶
func (p *PostgresInterface) GetCountOfUsers(ctx context.Context) (int, error)
func (*PostgresInterface) GetFreeUsernameId ¶
func (*PostgresInterface) GetIdByUsername ¶
func (*PostgresInterface) GetUserByID ¶
Accept the User ID and return the user or an error
func (*PostgresInterface) GetUserIdByLogin ¶
Accept the login and return the user or an error
func (*PostgresInterface) GetUsernameByID ¶
func (*PostgresInterface) IsLoginTaken ¶
func (*PostgresInterface) RemoveUser ¶
Deletes the user or returns an error
func (*PostgresInterface) SaveUser ¶
func (p *PostgresInterface) SaveUser( ctx context.Context, user entities.UserCreationOpts) (uuid.UUID, error)
Creates new user
func (*PostgresInterface) SetNilUsername ¶
func (*PostgresInterface) SetUsername ¶
func (*PostgresInterface) VerifyIdAndPassword ¶
Click to show internal directories.
Click to hide internal directories.