db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID        int64
	UserID    int64
	Username  string
	Address   string
	Seed      string
	CreatedAt pgtype.Timestamptz
}

type CreateAccountParams

type CreateAccountParams struct {
	UserID   int64
	Username string
	Address  string
	Seed     string
}

type CreateStateParams

type CreateStateParams struct {
	UserID int64
	State  string
	Data   map[string]interface{}
	Meta   map[string]interface{}
}

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 Querier

type Querier interface {
	CreateAccount(ctx context.Context, arg CreateAccountParams) (int64, error)
	CreateState(ctx context.Context, arg CreateStateParams) error
	GetAccount(ctx context.Context, userID int64) (Account, error)
	GetAccountByKey(ctx context.Context, key string) (Account, error)
	GetState(ctx context.Context, userID int64) (State, error)
	UpdateStateData(ctx context.Context, arg UpdateStateDataParams) error
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateAccount

func (q *Queries) CreateAccount(ctx context.Context, arg CreateAccountParams) (int64, error)

func (*Queries) CreateState

func (q *Queries) CreateState(ctx context.Context, arg CreateStateParams) error

func (*Queries) GetAccount

func (q *Queries) GetAccount(ctx context.Context, userID int64) (Account, error)

func (*Queries) GetAccountByKey

func (q *Queries) GetAccountByKey(ctx context.Context, key string) (Account, error)

func (*Queries) GetState

func (q *Queries) GetState(ctx context.Context, userID int64) (State, error)

func (*Queries) UpdateStateData

func (q *Queries) UpdateStateData(ctx context.Context, arg UpdateStateDataParams) error

func (*Queries) WithTx

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

type State

type State struct {
	UserID    int64
	State     string
	Data      map[string]interface{}
	Meta      map[string]interface{}
	CreatedAt pgtype.Timestamptz
}

type UpdateStateDataParams

type UpdateStateDataParams struct {
	Data   map[string]interface{}
	UserID int64
}

Jump to

Keyboard shortcuts

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