db

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 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 CoinType

type CoinType string
const (
	CoinTypeXMR CoinType = "XMR"
	CoinTypeBTC CoinType = "BTC"
	CoinTypeLTC CoinType = "LTC"
	CoinTypeETH CoinType = "ETH"
	CoinTypeTON CoinType = "TON"
)

func (*CoinType) Scan

func (e *CoinType) Scan(src interface{}) error

type ConfirmInvoiceStatusMempoolByIdParams

type ConfirmInvoiceStatusMempoolByIdParams struct {
	ID           pgtype.UUID
	ActualAmount pgtype.Float8
	TxID         pgtype.Text
}

type CreateCryptoAddressParams

type CreateCryptoAddressParams struct {
	Address    string
	Coin       CoinType
	IsOccupied bool
	UserID     pgtype.UUID
}

type CreateCryptoDataParams

type CreateCryptoDataParams struct {
	XmrID  pgtype.UUID
	UserID pgtype.UUID
}

type CreateInvoiceParams

type CreateInvoiceParams struct {
	CryptoAddress         string
	Coin                  CoinType
	RequiredAmount        float64
	ConfirmationsRequired int16
	ExpiresAt             pgtype.Timestamptz
	UserID                pgtype.UUID
}

type CreateXMRCryptoDataParams

type CreateXMRCryptoDataParams struct {
	PrivViewKey string
	PubSpendKey string
}

type CryptoAddress

type CryptoAddress struct {
	ID         pgtype.UUID
	Address    string
	Coin       CoinType
	IsOccupied bool
	UserID     pgtype.UUID
}

type CryptoCache

type CryptoCache struct {
	Coin                  CoinType
	LastSyncedBlockHeight pgtype.Int8
	SyncedTimestamp       pgtype.Timestamptz
}

type CryptoDatum

type CryptoDatum struct {
	UserID pgtype.UUID
	XmrID  pgtype.UUID
}

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 DeleteAllCryptoAddressByUserIdAndCoinParams

type DeleteAllCryptoAddressByUserIdAndCoinParams struct {
	UserID pgtype.UUID
	Coin   CoinType
}

type FindCryptoKeysByUserIdRow added in v0.3.0

type FindCryptoKeysByUserIdRow struct {
	PrivViewKey string
	PubSpendKey string
}

type FindIndicesAndLockXMRCryptoDataByIdRow

type FindIndicesAndLockXMRCryptoDataByIdRow struct {
	LastMajorIndex int32
	LastMinorIndex int32
}

type FindKeysAndLockXMRCryptoDataByIdRow

type FindKeysAndLockXMRCryptoDataByIdRow struct {
	PrivViewKey string
	PubSpendKey string
}

type FindNonOccupiedCryptoAddressAndLockByUserIdAndCoinParams

type FindNonOccupiedCryptoAddressAndLockByUserIdAndCoinParams struct {
	UserID pgtype.UUID
	Coin   CoinType
}

type Invoice

type Invoice struct {
	ID                    pgtype.UUID
	CryptoAddress         string
	Coin                  CoinType
	RequiredAmount        float64
	ActualAmount          pgtype.Float8
	ConfirmationsRequired int16
	CreatedAt             pgtype.Timestamptz
	ConfirmedAt           pgtype.Timestamptz
	Status                InvoiceStatusType
	ExpiresAt             pgtype.Timestamptz
	TxID                  pgtype.Text
	UserID                pgtype.UUID
}

type InvoiceStatusType

type InvoiceStatusType string
const (
	InvoiceStatusTypePENDING        InvoiceStatusType = "PENDING"
	InvoiceStatusTypePENDINGMEMPOOL InvoiceStatusType = "PENDING_MEMPOOL"
	InvoiceStatusTypeEXPIRED        InvoiceStatusType = "EXPIRED"
	InvoiceStatusTypeCONFIRMED      InvoiceStatusType = "CONFIRMED"
)

func (*InvoiceStatusType) Scan

func (e *InvoiceStatusType) Scan(src interface{}) error

type NullCoinType

type NullCoinType struct {
	CoinType CoinType
	Valid    bool // Valid is true if CoinType is not NULL
}

func (*NullCoinType) Scan

func (ns *NullCoinType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullCoinType) Value

func (ns NullCoinType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullInvoiceStatusType

type NullInvoiceStatusType struct {
	InvoiceStatusType InvoiceStatusType
	Valid             bool // Valid is true if InvoiceStatusType is not NULL
}

func (*NullInvoiceStatusType) Scan

func (ns *NullInvoiceStatusType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullInvoiceStatusType) Value

func (ns NullInvoiceStatusType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) ConfirmInvoiceById

func (q *Queries) ConfirmInvoiceById(ctx context.Context, id pgtype.UUID) (Invoice, error)

func (*Queries) ConfirmInvoiceStatusMempoolById

func (q *Queries) ConfirmInvoiceStatusMempoolById(ctx context.Context, arg ConfirmInvoiceStatusMempoolByIdParams) (Invoice, error)

func (*Queries) CreateCryptoAddress

func (q *Queries) CreateCryptoAddress(ctx context.Context, arg CreateCryptoAddressParams) (CryptoAddress, error)

func (*Queries) CreateCryptoData

func (q *Queries) CreateCryptoData(ctx context.Context, arg CreateCryptoDataParams) (CryptoDatum, error)

func (*Queries) CreateInvoice

func (q *Queries) CreateInvoice(ctx context.Context, arg CreateInvoiceParams) (Invoice, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context) (pgtype.UUID, error)

func (*Queries) CreateUserWithId added in v0.2.0

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

func (*Queries) CreateXMRCryptoData

func (q *Queries) CreateXMRCryptoData(ctx context.Context, arg CreateXMRCryptoDataParams) (XmrCryptoDatum, error)

XMR

func (*Queries) DeleteAllCryptoAddressByUserIdAndCoin

func (q *Queries) DeleteAllCryptoAddressByUserIdAndCoin(ctx context.Context, arg DeleteAllCryptoAddressByUserIdAndCoinParams) ([]CryptoAddress, error)

func (*Queries) ExpireInvoiceById

func (q *Queries) ExpireInvoiceById(ctx context.Context, id pgtype.UUID) (Invoice, error)

func (*Queries) FindAllInvoicesByIds

func (q *Queries) FindAllInvoicesByIds(ctx context.Context, dollar_1 []pgtype.UUID) ([]Invoice, error)

func (*Queries) FindAllPendingInvoices

func (q *Queries) FindAllPendingInvoices(ctx context.Context) ([]Invoice, error)

func (*Queries) FindCryptoCacheByCoin

func (q *Queries) FindCryptoCacheByCoin(ctx context.Context, coin CoinType) (CryptoCache, error)

func (*Queries) FindCryptoDataByUserId

func (q *Queries) FindCryptoDataByUserId(ctx context.Context, userID pgtype.UUID) (CryptoDatum, error)

func (*Queries) FindCryptoKeysByUserId added in v0.3.0

func (q *Queries) FindCryptoKeysByUserId(ctx context.Context, userID pgtype.UUID) (FindCryptoKeysByUserIdRow, error)

func (*Queries) FindIndicesAndLockXMRCryptoDataById

func (q *Queries) FindIndicesAndLockXMRCryptoDataById(ctx context.Context, id pgtype.UUID) (FindIndicesAndLockXMRCryptoDataByIdRow, error)

func (*Queries) FindKeysAndLockXMRCryptoDataById

func (q *Queries) FindKeysAndLockXMRCryptoDataById(ctx context.Context, id pgtype.UUID) (FindKeysAndLockXMRCryptoDataByIdRow, error)

func (*Queries) FindNonOccupiedCryptoAddressAndLockByUserIdAndCoin

func (q *Queries) FindNonOccupiedCryptoAddressAndLockByUserIdAndCoin(ctx context.Context, arg FindNonOccupiedCryptoAddressAndLockByUserIdAndCoinParams) (CryptoAddress, error)

func (*Queries) SetXMRCryptoDataByUserId

func (q *Queries) SetXMRCryptoDataByUserId(ctx context.Context, arg SetXMRCryptoDataByUserIdParams) (CryptoDatum, error)

func (*Queries) ShiftExpiresAtForNonConfirmedInvoices

func (q *Queries) ShiftExpiresAtForNonConfirmedInvoices(ctx context.Context) ([]Invoice, error)

func (*Queries) UpdateCryptoCacheByCoin

func (q *Queries) UpdateCryptoCacheByCoin(ctx context.Context, arg UpdateCryptoCacheByCoinParams) (CryptoCache, error)

func (*Queries) UpdateIndicesXMRCryptoDataById

func (q *Queries) UpdateIndicesXMRCryptoDataById(ctx context.Context, arg UpdateIndicesXMRCryptoDataByIdParams) (XmrCryptoDatum, error)

func (*Queries) UpdateIsOccupiedByCryptoAddress

func (q *Queries) UpdateIsOccupiedByCryptoAddress(ctx context.Context, arg UpdateIsOccupiedByCryptoAddressParams) (CryptoAddress, error)

func (*Queries) UpdateKeysXMRCryptoDataById

func (q *Queries) UpdateKeysXMRCryptoDataById(ctx context.Context, arg UpdateKeysXMRCryptoDataByIdParams) (XmrCryptoDatum, error)

func (*Queries) UserExistsById

func (q *Queries) UserExistsById(ctx context.Context, id pgtype.UUID) (bool, error)

func (*Queries) WithTx

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

type SetXMRCryptoDataByUserIdParams

type SetXMRCryptoDataByUserIdParams struct {
	UserID pgtype.UUID
	XmrID  pgtype.UUID
}

type UpdateCryptoCacheByCoinParams

type UpdateCryptoCacheByCoinParams struct {
	Coin                  CoinType
	LastSyncedBlockHeight pgtype.Int8
}

type UpdateIndicesXMRCryptoDataByIdParams

type UpdateIndicesXMRCryptoDataByIdParams struct {
	ID             pgtype.UUID
	LastMajorIndex int32
	LastMinorIndex int32
}

type UpdateIsOccupiedByCryptoAddressParams

type UpdateIsOccupiedByCryptoAddressParams struct {
	Address    string
	IsOccupied bool
}

type UpdateKeysXMRCryptoDataByIdParams

type UpdateKeysXMRCryptoDataByIdParams struct {
	ID          pgtype.UUID
	PrivViewKey string
	PubSpendKey string
}

type User

type User struct {
	ID pgtype.UUID
}

type XmrCryptoDatum

type XmrCryptoDatum struct {
	ID             pgtype.UUID
	PrivViewKey    string
	PubSpendKey    string
	LastMajorIndex int32
	LastMinorIndex int32
}

Jump to

Keyboard shortcuts

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