postgres

package
v0.0.0-...-9293419 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Querier

type Querier interface {
	GetUserByID(ctx context.Context, userID uuid.UUID) (User, error)
	GetUserByUsername(ctx context.Context, upper interface{}) (User, error)
	//------- USERS SAVE ------------------
	SaveUser(ctx context.Context, arg SaveUserParams) (User, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) GetUserByID

func (q *Queries) GetUserByID(ctx context.Context, userID uuid.UUID) (User, error)

func (*Queries) GetUserByUsername

func (q *Queries) GetUserByUsername(ctx context.Context, upper interface{}) (User, error)

func (*Queries) SaveUser

func (q *Queries) SaveUser(ctx context.Context, arg SaveUserParams) (User, error)

------- USERS SAVE ------------------

func (*Queries) WithTx

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

type SaveUserParams

type SaveUserParams struct {
	UserID                 uuid.UUID      `json:"user_id"`
	Email                  string         `json:"email"`
	Username               string         `json:"username"`
	PasswordHash           []byte         `json:"password_hash"`
	VerificationCode       sql.NullString `json:"verification_code"`
	VerificationExpiration sql.NullTime   `json:"verification_expiration"`
	Verified               bool           `json:"verified"`
	Active                 bool           `json:"active"`
}

type Store

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

func NewStore

func NewStore(db *sql.DB) *Store

type User

type User struct {
	UserID                 uuid.UUID      `json:"user_id"`
	Email                  string         `json:"email"`
	Username               string         `json:"username"`
	PasswordHash           []byte         `json:"password_hash"`
	VerificationCode       sql.NullString `json:"verification_code"`
	VerificationExpiration sql.NullTime   `json:"verification_expiration"`
	Verified               bool           `json:"verified"`
	Active                 bool           `json:"active"`
	CreatedAt              time.Time      `json:"created_at"`
	UpdatedAt              time.Time      `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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