users

package
v0.0.0-...-f348597 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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 (p *PostgresInterface) ChangeDisplayedName(ctx context.Context, uID uuid.UUID, newName string) error

func (*PostgresInterface) ChangeLogin

func (p *PostgresInterface) ChangeLogin(ctx context.Context, uID uuid.UUID, newLogin string) error

func (*PostgresInterface) ChangePassword

func (p *PostgresInterface) ChangePassword(ctx context.Context, uID uuid.UUID, newPassowrd string) error

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

func (p *PostgresInterface) GetByWhoBannedUserID(ctx context.Context, uID uuid.UUID) error

TODO: Scan data into the structure

func (*PostgresInterface) GetCountOfUsers

func (p *PostgresInterface) GetCountOfUsers(ctx context.Context) (int, error)

func (*PostgresInterface) GetFreeUsernameId

func (p *PostgresInterface) GetFreeUsernameId(
	ctx context.Context, username string) (int, error)

func (*PostgresInterface) GetIdByUsername

func (p *PostgresInterface) GetIdByUsername(
	ctx context.Context, uname username.Username) (uuid.UUID, error)

func (*PostgresInterface) GetUserByID

func (p *PostgresInterface) GetUserByID(ctx context.Context, id uuid.UUID) (entities.User, error)

Accept the User ID and return the user or an error

func (*PostgresInterface) GetUserIdByLogin

func (p *PostgresInterface) GetUserIdByLogin(ctx context.Context, login string) (uuid.UUID, error)

Accept the login and return the user or an error

func (*PostgresInterface) GetUsernameByID

func (p *PostgresInterface) GetUsernameByID(
	ctx context.Context, uID uuid.UUID) (username.Username, error)

func (*PostgresInterface) IsAdmin

func (p *PostgresInterface) IsAdmin(ctx context.Context, uID uuid.UUID) (bool, error)

func (*PostgresInterface) IsBanned

func (p *PostgresInterface) IsBanned(ctx context.Context, bannedId uuid.UUID, bannedById uuid.UUID) (bool, error)

func (*PostgresInterface) IsLoginTaken

func (p *PostgresInterface) IsLoginTaken(ctx context.Context, login string) (bool, error)

func (*PostgresInterface) MakeAdmin

func (p *PostgresInterface) MakeAdmin(ctx context.Context, uID uuid.UUID) error

func (*PostgresInterface) RemoveUser

func (p *PostgresInterface) RemoveUser(ctx context.Context, id uuid.UUID) error

Deletes the user or returns an error

func (*PostgresInterface) SaveUser

Creates new user

func (*PostgresInterface) SetNilUsername

func (p *PostgresInterface) SetNilUsername(
	ctx context.Context, uID uuid.UUID) error

func (*PostgresInterface) SetUsername

func (p *PostgresInterface) SetUsername(
	ctx context.Context, uID uuid.UUID, username string) error

func (*PostgresInterface) UnbanUser

func (p *PostgresInterface) UnbanUser(ctx context.Context, bannedId uuid.UUID, bannedBy uuid.UUID) error

func (*PostgresInterface) VerifyIdAndPassword

func (p *PostgresInterface) VerifyIdAndPassword(ctx context.Context, uid uuid.UUID, password string) (bool, error)

func (*PostgresInterface) VerifyLoginCreds

func (p *PostgresInterface) VerifyLoginCreds(ctx context.Context, creds entities.Creds) (uuid.UUID, bool, error)

Jump to

Keyboard shortcuts

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