db

package
v0.0.0-...-deaf358 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConnection

func CreateConnection(ctx context.Context, dbUrl string) *pgx.Conn

Types

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 GetQueries

func GetQueries() *Queries

func New

func New(db DBTX) *Queries

func (*Queries) GetUserByEmail

func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)

func (*Queries) GetUserById

func (q *Queries) GetUserById(ctx context.Context, id pgtype.UUID) (User, error)

func (*Queries) UpsertUser

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

func (*Queries) WithTx

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

type UpsertUserParams

type UpsertUserParams struct {
	FullName          string `json:"full_name"`
	Email             string `json:"email"`
	PhoneNumber       string `json:"phone_number"`
	ProfilePictureUrl string `json:"profile_picture_url"`
	Username          string `json:"username"`
	HashedPassword    string `json:"hashed_password"`
}

type User

type User struct {
	ID                pgtype.UUID        `json:"id"`
	FullName          string             `json:"full_name"`
	Email             string             `json:"email"`
	PhoneNumber       string             `json:"phone_number"`
	ProfilePictureUrl string             `json:"profile_picture_url"`
	Username          string             `json:"username"`
	HashedPassword    string             `json:"hashed_password"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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