sqlc

package
v0.14.1-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 3 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
	Alias              int64
	Label              sql.NullString
	Type               int16
	InitialBalanceMsat int64
	CurrentBalanceMsat int64
	LastUpdated        time.Time
	Expiration         time.Time
}

type AccountIndex

type AccountIndex struct {
	Name  string
	Value int64
}

type AccountInvoice

type AccountInvoice struct {
	AccountID int64
	Hash      []byte
}

type AccountPayment

type AccountPayment struct {
	AccountID      int64
	Hash           []byte
	Status         int16
	FullAmountMsat int64
}

type AddAccountInvoiceParams

type AddAccountInvoiceParams struct {
	AccountID int64
	Hash      []byte
}

type BackendType

type BackendType uint8

BackendType is an enum that represents the type of database backend we're using.

const (
	// BackendTypeUnknown indicates we're using an unknown backend.
	BackendTypeUnknown BackendType = iota

	// BackendTypeSqlite indicates we're using a SQLite backend.
	BackendTypeSqlite

	// BackendTypePostgres indicates we're using a Postgres backend.
	BackendTypePostgres
)

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 DeleteAccountPaymentParams

type DeleteAccountPaymentParams struct {
	Hash      []byte
	AccountID int64
}

type GetAccountInvoiceParams

type GetAccountInvoiceParams struct {
	AccountID int64
	Hash      []byte
}

type GetAccountPaymentParams

type GetAccountPaymentParams struct {
	Hash      []byte
	AccountID int64
}

type InsertAccountParams

type InsertAccountParams struct {
	Type               int16
	InitialBalanceMsat int64
	CurrentBalanceMsat int64
	LastUpdated        time.Time
	Label              sql.NullString
	Alias              int64
	Expiration         time.Time
}

type Querier

type Querier interface {
	AddAccountInvoice(ctx context.Context, arg AddAccountInvoiceParams) error
	DeleteAccount(ctx context.Context, id int64) error
	DeleteAccountPayment(ctx context.Context, arg DeleteAccountPaymentParams) error
	GetAccount(ctx context.Context, id int64) (Account, error)
	GetAccountByLabel(ctx context.Context, label sql.NullString) (Account, error)
	GetAccountIDByAlias(ctx context.Context, alias int64) (int64, error)
	GetAccountIndex(ctx context.Context, name string) (int64, error)
	GetAccountInvoice(ctx context.Context, arg GetAccountInvoiceParams) (AccountInvoice, error)
	GetAccountPayment(ctx context.Context, arg GetAccountPaymentParams) (AccountPayment, error)
	InsertAccount(ctx context.Context, arg InsertAccountParams) (int64, error)
	ListAccountInvoices(ctx context.Context, accountID int64) ([]AccountInvoice, error)
	ListAccountPayments(ctx context.Context, accountID int64) ([]AccountPayment, error)
	ListAllAccounts(ctx context.Context) ([]Account, error)
	SetAccountIndex(ctx context.Context, arg SetAccountIndexParams) error
	UpdateAccountBalance(ctx context.Context, arg UpdateAccountBalanceParams) (int64, error)
	UpdateAccountExpiry(ctx context.Context, arg UpdateAccountExpiryParams) (int64, error)
	UpdateAccountLastUpdate(ctx context.Context, arg UpdateAccountLastUpdateParams) (int64, error)
	UpsertAccountPayment(ctx context.Context, arg UpsertAccountPaymentParams) error
}

type Queries

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

func New

func New(db DBTX) *Queries

func NewPostgres

func NewPostgres(db DBTX) *Queries

NewPostgres creates a new Queries instance for a Postgres database.

func NewSqlite

func NewSqlite(db DBTX) *Queries

NewSqlite creates a new Queries instance for a SQLite database.

func (*Queries) AddAccountInvoice

func (q *Queries) AddAccountInvoice(ctx context.Context, arg AddAccountInvoiceParams) error

func (*Queries) Backend

func (q *Queries) Backend() BackendType

Backend returns the type of database backend we're using.

func (*Queries) DeleteAccount

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

func (*Queries) DeleteAccountPayment

func (q *Queries) DeleteAccountPayment(ctx context.Context, arg DeleteAccountPaymentParams) error

func (*Queries) GetAccount

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

func (*Queries) GetAccountByLabel

func (q *Queries) GetAccountByLabel(ctx context.Context, label sql.NullString) (Account, error)

func (*Queries) GetAccountIDByAlias

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

func (*Queries) GetAccountIndex

func (q *Queries) GetAccountIndex(ctx context.Context, name string) (int64, error)

func (*Queries) GetAccountInvoice

func (q *Queries) GetAccountInvoice(ctx context.Context, arg GetAccountInvoiceParams) (AccountInvoice, error)

func (*Queries) GetAccountPayment

func (q *Queries) GetAccountPayment(ctx context.Context, arg GetAccountPaymentParams) (AccountPayment, error)

func (*Queries) InsertAccount

func (q *Queries) InsertAccount(ctx context.Context, arg InsertAccountParams) (int64, error)

func (*Queries) ListAccountInvoices

func (q *Queries) ListAccountInvoices(ctx context.Context, accountID int64) ([]AccountInvoice, error)

func (*Queries) ListAccountPayments

func (q *Queries) ListAccountPayments(ctx context.Context, accountID int64) ([]AccountPayment, error)

func (*Queries) ListAllAccounts

func (q *Queries) ListAllAccounts(ctx context.Context) ([]Account, error)

func (*Queries) SetAccountIndex

func (q *Queries) SetAccountIndex(ctx context.Context, arg SetAccountIndexParams) error

func (*Queries) UpdateAccountBalance

func (q *Queries) UpdateAccountBalance(ctx context.Context, arg UpdateAccountBalanceParams) (int64, error)

func (*Queries) UpdateAccountExpiry

func (q *Queries) UpdateAccountExpiry(ctx context.Context, arg UpdateAccountExpiryParams) (int64, error)

func (*Queries) UpdateAccountLastUpdate

func (q *Queries) UpdateAccountLastUpdate(ctx context.Context, arg UpdateAccountLastUpdateParams) (int64, error)

func (*Queries) UpsertAccountPayment

func (q *Queries) UpsertAccountPayment(ctx context.Context, arg UpsertAccountPaymentParams) error

func (*Queries) WithTx

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

type SetAccountIndexParams

type SetAccountIndexParams struct {
	Name  string
	Value int64
}

type UpdateAccountBalanceParams

type UpdateAccountBalanceParams struct {
	CurrentBalanceMsat int64
	ID                 int64
}

type UpdateAccountExpiryParams

type UpdateAccountExpiryParams struct {
	Expiration time.Time
	ID         int64
}

type UpdateAccountLastUpdateParams

type UpdateAccountLastUpdateParams struct {
	LastUpdated time.Time
	ID          int64
}

type UpsertAccountPaymentParams

type UpsertAccountPaymentParams struct {
	AccountID      int64
	Hash           []byte
	Status         int16
	FullAmountMsat int64
}

Jump to

Keyboard shortcuts

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