package models

import "github.com/go-arrower/arrower/contexts/auth/internal/interfaces/repository/models"

Index

Types

type AllUsersParams

type AllUsersParams struct {
	Limit int32
	Login string
}

type AuthSession

type AuthSession struct {
	Key          []byte
	Data         []byte
	ExpiresAtUtc pgtype.Timestamptz
	UserID       uuid.NullUUID
	UserAgent    string
	CreatedAt    pgtype.Timestamptz
	UpdatedAt    pgtype.Timestamptz
}

type AuthUser

type AuthUser struct {
	ID              uuid.UUID
	CreatedAt       pgtype.Timestamptz
	UpdatedAt       pgtype.Timestamptz
	Login           string
	PasswordHash    string
	NameFirstname   string
	NameLastname    string
	NameDisplayname string
	Birthday        pgtype.Date
	Locale          string
	TimeZone        string
	PictureUrl      string
	Profile         pgtype.Hstore
	VerifiedAtUtc   pgtype.Timestamptz
	BlockedAtUtc    pgtype.Timestamptz
	SuperuserAtUtc  pgtype.Timestamptz
}

type AuthUserVerification

type AuthUserVerification struct {
	Token         uuid.UUID
	UserID        uuid.UUID
	ValidUntilUtc pgtype.Timestamptz
	CreatedAt     pgtype.Timestamptz
	UpdatedAt     pgtype.Timestamptz
}

type CreateUserParams

type CreateUserParams struct {
	ID            uuid.UUID
	Login         string
	PasswordHash  string
	VerifiedAtUtc pgtype.Timestamptz
	BlockedAtUtc  pgtype.Timestamptz
}

type CreateVerificationTokenParams

type CreateVerificationTokenParams struct {
	Token         uuid.UUID
	UserID        uuid.UUID
	ValidUntilUtc pgtype.Timestamptz
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AllSessions

func (q *Queries) AllSessions(ctx context.Context) ([]AuthSession, error)

------------------- ---- Session ------ -------------------

func (*Queries) AllUsers

func (q *Queries) AllUsers(ctx context.Context, arg AllUsersParams) ([]AuthUser, error)

---------------- ---- User ------ ----------------

func (*Queries) AllUsersByIDs

func (q *Queries) AllUsersByIDs(ctx context.Context, dollar_1 []uuid.UUID) ([]AuthUser, error)

func (*Queries) CountUsers

func (q *Queries) CountUsers(ctx context.Context) (int64, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (AuthUser, error)

func (*Queries) CreateVerificationToken

func (q *Queries) CreateVerificationToken(ctx context.Context, arg CreateVerificationTokenParams) error

func (*Queries) DeleteAllUsers

func (q *Queries) DeleteAllUsers(ctx context.Context) error

func (*Queries) DeleteSessionByKey

func (q *Queries) DeleteSessionByKey(ctx context.Context, key []byte) error

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, dollar_1 []uuid.UUID) error

func (*Queries) FindSessionDataByKey

func (q *Queries) FindSessionDataByKey(ctx context.Context, key []byte) ([]byte, error)

func (*Queries) FindSessionsByUserID

func (q *Queries) FindSessionsByUserID(ctx context.Context, userID uuid.NullUUID) ([]AuthSession, error)

func (*Queries) FindUserByID

func (q *Queries) FindUserByID(ctx context.Context, id uuid.UUID) (AuthUser, error)

func (*Queries) FindUserByLogin

func (q *Queries) FindUserByLogin(ctx context.Context, login string) (AuthUser, error)

func (*Queries) UpsertNewSession

func (q *Queries) UpsertNewSession(ctx context.Context, arg UpsertNewSessionParams) error

func (*Queries) UpsertSessionData

func (q *Queries) UpsertSessionData(ctx context.Context, arg UpsertSessionDataParams) error

func (*Queries) UpsertUser

func (q *Queries) UpsertUser(ctx context.Context, arg UpsertUserParams) (AuthUser, error)

func (*Queries) UserExistsByID

func (q *Queries) UserExistsByID(ctx context.Context, id uuid.UUID) (bool, error)

func (*Queries) UserExistsByLogin

func (q *Queries) UserExistsByLogin(ctx context.Context, login string) (bool, error)

func (*Queries) VerificationTokenByToken

func (q *Queries) VerificationTokenByToken(ctx context.Context, token uuid.UUID) (AuthUserVerification, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type UpsertNewSessionParams

type UpsertNewSessionParams struct {
	Key       []byte
	UserID    uuid.NullUUID
	UserAgent string
}

type UpsertSessionDataParams

type UpsertSessionDataParams struct {
	Key          []byte
	Data         []byte
	ExpiresAtUtc pgtype.Timestamptz
}

type UpsertUserParams

type UpsertUserParams struct {
	ID              uuid.UUID
	CreatedAt       pgtype.Timestamptz
	Login           string
	PasswordHash    string
	NameFirstname   string
	NameLastname    string
	NameDisplayname string
	Birthday        pgtype.Date
	Locale          string
	TimeZone        string
	PictureUrl      string
	Profile         pgtype.Hstore
	VerifiedAtUtc   pgtype.Timestamptz
	BlockedAtUtc    pgtype.Timestamptz
	SuperuserAtUtc  pgtype.Timestamptz
}

Source Files

db.go models.go query.sql.go

Version
v0.0.0-20250311203644-ab26c1152cb4 (latest)
Published
Mar 11, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
1 week ago

Tools for package owners.