database

package
v0.0.0-...-2142fb5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RefreshNameSpace string = "user_auth:user_refresh"
)

Variables

This section is empty.

Functions

func DeleteToken

func DeleteToken(r *http.Request, client *redis.Client, arg pgtype.UUID) error

func DeleteUser

func DeleteUser(r *http.Request, conn *pgxpool.Pool, arg int) (int64, error)

func GenericErrorLogger

func GenericErrorLogger(err error, mssg string)

func StoreToken

func StoreToken(r *http.Request, client *redis.Client, arg RedisToken) error

Types

type CreateUserParams

type CreateUserParams struct {
	Username     string
	DisplayName  string
	Password     []byte
	PasswordSalt []byte
}

type HealthChecks

type HealthChecks struct {
	Data string
}

Query Param structs

func HealthCheck

func HealthCheck(r *http.Request, conn *pgxpool.Pool, arg HealthChecks) (HealthChecks, error)

type RedisToken

type RedisToken struct {
	UserId       string    `redis:"user_id"`
	UserPvtId    int       `redis:"user_pvt_id"`
	Expiry       time.Time `redis:"-"`
	RefreshToken string    `redis:"-"`
}

func GetToken

func GetToken(r *http.Request, client *redis.Client, refreshToken string) (RedisToken, error)

type UpdateUserParams

type UpdateUserParams struct {
	Username    string
	DisplayName string
	Password    []byte
	PvtId       int
}

type User

type User struct {
	PvtId        int
	UserId       pgtype.UUID
	Username     string
	DisplayName  string
	Password     []byte
	PasswordSalt []byte
	CreatedAt    time.Time
	UpdatedAt    time.Time
	LastLoggedIn time.Time
}

DB User

func CreateUser

func CreateUser(r *http.Request, conn *pgxpool.Pool, arg CreateUserParams) (User, error)

func GetUserById

func GetUserById(r *http.Request, conn *pgxpool.Pool, arg int) (User, error)

func GetUserByUUID

func GetUserByUUID(r *http.Request, conn *pgxpool.Pool, arg pgtype.UUID) (User, error)

func GetUserByUserName

func GetUserByUserName(r *http.Request, conn *pgxpool.Pool, arg string) (User, error)

func UpdateUser

func UpdateUser(r *http.Request, conn *pgxpool.Pool, arg UpdateUserParams) (User, error)

func (*User) ScanRow

func (u *User) ScanRow(row pgx.Row) error

Jump to

Keyboard shortcuts

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