user

package
v0.0.0-...-0cdd26c Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlacklistType

type BlacklistType uint
const (
	BlacklistIPAddress BlacklistType = iota
	BlacklistRefreshToken
)

type ConnectionDTO

type ConnectionDTO struct {
	ID        string    `db:"id"`
	UserID    uuid.UUID `db:"user_id"`
	Provider  string    `db:"provider"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
	DeletedAt time.Time `db:"deleted_at"`
}

type ConnectionParams

type ConnectionParams struct {
	ID       string
	UserID   uuid.UUID
	Provider string
}

type UserDTO

type UserDTO struct {
	ID        uuid.UUID `db:"id"`
	Username  string    `db:"username"`
	Email     string    `db:"email"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
	DeletedAt time.Time `db:"deleted_at"`
}

type UserParams

type UserParams struct {
	Username string
	Email    string
}

func (*UserParams) Validate

func (p *UserParams) Validate() error

type UserRepo

type UserRepo struct {
	// contains filtered or unexported fields
}

func NewUserRepo

func NewUserRepo(db *sqlx.DB, redis rueidis.Client) *UserRepo

func (*UserRepo) Blacklist

func (r *UserRepo) Blacklist(ctx context.Context, typ BlacklistType, val string, exp time.Duration) error

func (*UserRepo) CreateConnection

func (r *UserRepo) CreateConnection(ctx context.Context, c *ConnectionParams) (*ConnectionDTO, error)

func (*UserRepo) CreateUser

func (r *UserRepo) CreateUser(ctx context.Context, u *UserParams) (*UserDTO, error)

func (*UserRepo) DeleteConnection

func (r *UserRepo) DeleteConnection(ctx context.Context, id string) error

func (*UserRepo) DeleteUser

func (r *UserRepo) DeleteUser(ctx context.Context, id uuid.UUID) error

func (*UserRepo) GetConnectionByConnectionID

func (r *UserRepo) GetConnectionByConnectionID(ctx context.Context, id string) (*ConnectionDTO, error)

func (*UserRepo) GetConnectionsByUserID

func (r *UserRepo) GetConnectionsByUserID(ctx context.Context, id uuid.UUID) ([]ConnectionDTO, error)

func (*UserRepo) GetUserByEmail

func (r *UserRepo) GetUserByEmail(ctx context.Context, email string) (*UserDTO, error)

func (*UserRepo) GetUserByID

func (r *UserRepo) GetUserByID(ctx context.Context, id uuid.UUID) (*UserDTO, error)

func (*UserRepo) IsBlacklisted

func (r *UserRepo) IsBlacklisted(ctx context.Context, typ BlacklistType, val string) (bool, error)

func (*UserRepo) UpdateConnection

func (r *UserRepo) UpdateConnection(ctx context.Context, id string, c *ConnectionParams) error

func (*UserRepo) UpdateUser

func (r *UserRepo) UpdateUser(ctx context.Context, id uuid.UUID, u *UserParams) error

Jump to

Keyboard shortcuts

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