db

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 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 BnbCryptoDatum added in v0.8.0

type BnbCryptoDatum struct {
	ID             pgtype.UUID
	MasterPubKey   string
	LastMajorIndex int32
	LastMinorIndex int32
}

type BtcCryptoDatum added in v0.5.0

type BtcCryptoDatum struct {
	ID             pgtype.UUID
	MasterPubKey   string
	LastMajorIndex int32
	LastMinorIndex int32
}

type CoinType

type CoinType string
const (
	CoinTypeXMR         CoinType = "XMR"
	CoinTypeBTC         CoinType = "BTC"
	CoinTypeLTC         CoinType = "LTC"
	CoinTypeETH         CoinType = "ETH"
	CoinTypeTON         CoinType = "TON"
	CoinTypeUSDTERC20   CoinType = "USDT_ERC20"
	CoinTypeUSDCERC20   CoinType = "USDC_ERC20"
	CoinTypeDAIERC20    CoinType = "DAI_ERC20"
	CoinTypeWBTCERC20   CoinType = "WBTC_ERC20"
	CoinTypeUNIERC20    CoinType = "UNI_ERC20"
	CoinTypeLINKERC20   CoinType = "LINK_ERC20"
	CoinTypeAAVEERC20   CoinType = "AAVE_ERC20"
	CoinTypeCRVERC20    CoinType = "CRV_ERC20"
	CoinTypeMATICERC20  CoinType = "MATIC_ERC20"
	CoinTypeSHIBERC20   CoinType = "SHIB_ERC20"
	CoinTypeBNBERC20    CoinType = "BNB_ERC20"
	CoinTypeATOMERC20   CoinType = "ATOM_ERC20"
	CoinTypeARBERC20    CoinType = "ARB_ERC20"
	CoinTypeBNB         CoinType = "BNB"
	CoinTypeBSCUSDBEP20 CoinType = "BSC-USD_BEP20"
	CoinTypeUSDCBEP20   CoinType = "USDC_BEP20"
	CoinTypeDAIBEP20    CoinType = "DAI_BEP20"
	CoinTypeBUSDBEP20   CoinType = "BUSD_BEP20"
	CoinTypeWBTCBEP20   CoinType = "WBTC_BEP20"
	CoinTypeBTCBBEP20   CoinType = "BTCB_BEP20"
	CoinTypeUNIBEP20    CoinType = "UNI_BEP20"
	CoinTypeLINKBEP20   CoinType = "LINK_BEP20"
	CoinTypeAAVEBEP20   CoinType = "AAVE_BEP20"
	CoinTypeMATICBEP20  CoinType = "MATIC_BEP20"
	CoinTypeSHIBBEP20   CoinType = "SHIB_BEP20"
	CoinTypeATOMBEP20   CoinType = "ATOM_BEP20"
	CoinTypeARBBEP20    CoinType = "ARB_BEP20"
	CoinTypeETHBEP20    CoinType = "ETH_BEP20"
	CoinTypeXRPBEP20    CoinType = "XRP_BEP20"
	CoinTypeADABEP20    CoinType = "ADA_BEP20"
	CoinTypeTRXBEP20    CoinType = "TRX_BEP20"
	CoinTypeDOGEBEP20   CoinType = "DOGE_BEP20"
	CoinTypeLTCBEP20    CoinType = "LTC_BEP20"
	CoinTypeBCHBEP20    CoinType = "BCH_BEP20"
	CoinTypeTWTBEP20    CoinType = "TWT_BEP20"
	CoinTypeAVAXBEP20   CoinType = "AVAX_BEP20"
	CoinTypeCAKEBEP20   CoinType = "CAKE_BEP20"
)

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
	BtcID  pgtype.UUID
	LtcID  pgtype.UUID
	EthID  pgtype.UUID
	BnbID  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
	BtcID  pgtype.UUID
	LtcID  pgtype.UUID
	EthID  pgtype.UUID
	BnbID  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 EthCryptoDatum added in v0.7.0

type EthCryptoDatum struct {
	ID             pgtype.UUID
	MasterPubKey   string
	LastMajorIndex int32
	LastMinorIndex int32
}

type FindIndicesAndLockBNBCryptoDataByIdRow added in v0.8.0

type FindIndicesAndLockBNBCryptoDataByIdRow struct {
	LastMajorIndex int32
	LastMinorIndex int32
}

type FindIndicesAndLockBTCCryptoDataByIdRow added in v0.5.0

type FindIndicesAndLockBTCCryptoDataByIdRow struct {
	LastMajorIndex int32
	LastMinorIndex int32
}

type FindIndicesAndLockETHCryptoDataByIdRow added in v0.7.0

type FindIndicesAndLockETHCryptoDataByIdRow struct {
	LastMajorIndex int32
	LastMinorIndex int32
}

type FindIndicesAndLockLTCCryptoDataByIdRow added in v0.6.0

type FindIndicesAndLockLTCCryptoDataByIdRow struct {
	LastMajorIndex int32
	LastMinorIndex int32
}

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 LtcCryptoDatum added in v0.6.0

type LtcCryptoDatum struct {
	ID             pgtype.UUID
	MasterPubKey   string
	LastMajorIndex int32
	LastMinorIndex int32
}

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) CreateBNBCryptoData added in v0.8.0

func (q *Queries) CreateBNBCryptoData(ctx context.Context, masterPubKey string) (BnbCryptoDatum, error)

BNB

func (*Queries) CreateBTCCryptoData added in v0.5.0

func (q *Queries) CreateBTCCryptoData(ctx context.Context, masterPubKey string) (BtcCryptoDatum, error)

BTC

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) CreateETHCryptoData added in v0.7.0

func (q *Queries) CreateETHCryptoData(ctx context.Context, masterPubKey string) (EthCryptoDatum, error)

ETH

func (*Queries) CreateInvoice

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

func (*Queries) CreateLTCCryptoData added in v0.6.0

func (q *Queries) CreateLTCCryptoData(ctx context.Context, masterPubKey string) (LtcCryptoDatum, error)

LTC

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) 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) FindIndicesAndLockBNBCryptoDataById added in v0.8.0

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

func (*Queries) FindIndicesAndLockBTCCryptoDataById added in v0.5.0

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

func (*Queries) FindIndicesAndLockETHCryptoDataById added in v0.7.0

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

func (*Queries) FindIndicesAndLockLTCCryptoDataById added in v0.6.0

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

func (*Queries) FindIndicesAndLockXMRCryptoDataById

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

func (*Queries) FindKeysAndLockBNBCryptoDataById added in v0.8.0

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

func (*Queries) FindKeysAndLockBTCCryptoDataById added in v0.5.0

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

func (*Queries) FindKeysAndLockETHCryptoDataById added in v0.7.0

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

func (*Queries) FindKeysAndLockLTCCryptoDataById added in v0.6.0

func (q *Queries) FindKeysAndLockLTCCryptoDataById(ctx context.Context, id pgtype.UUID) (string, 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) SetBNBCryptoDataByUserId added in v0.8.0

func (q *Queries) SetBNBCryptoDataByUserId(ctx context.Context, arg SetBNBCryptoDataByUserIdParams) (CryptoDatum, error)

func (*Queries) SetBTCCryptoDataByUserId added in v0.5.0

func (q *Queries) SetBTCCryptoDataByUserId(ctx context.Context, arg SetBTCCryptoDataByUserIdParams) (CryptoDatum, error)

func (*Queries) SetETHCryptoDataByUserId added in v0.7.0

func (q *Queries) SetETHCryptoDataByUserId(ctx context.Context, arg SetETHCryptoDataByUserIdParams) (CryptoDatum, error)

func (*Queries) SetLTCCryptoDataByUserId added in v0.6.0

func (q *Queries) SetLTCCryptoDataByUserId(ctx context.Context, arg SetLTCCryptoDataByUserIdParams) (CryptoDatum, 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) UpdateIndicesBNBCryptoDataById added in v0.8.0

func (q *Queries) UpdateIndicesBNBCryptoDataById(ctx context.Context, arg UpdateIndicesBNBCryptoDataByIdParams) (BnbCryptoDatum, error)

func (*Queries) UpdateIndicesBTCCryptoDataById added in v0.5.0

func (q *Queries) UpdateIndicesBTCCryptoDataById(ctx context.Context, arg UpdateIndicesBTCCryptoDataByIdParams) (BtcCryptoDatum, error)

func (*Queries) UpdateIndicesETHCryptoDataById added in v0.7.0

func (q *Queries) UpdateIndicesETHCryptoDataById(ctx context.Context, arg UpdateIndicesETHCryptoDataByIdParams) (EthCryptoDatum, error)

func (*Queries) UpdateIndicesLTCCryptoDataById added in v0.6.0

func (q *Queries) UpdateIndicesLTCCryptoDataById(ctx context.Context, arg UpdateIndicesLTCCryptoDataByIdParams) (LtcCryptoDatum, 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) UpdateKeysBNBCryptoDataById added in v0.8.0

func (q *Queries) UpdateKeysBNBCryptoDataById(ctx context.Context, arg UpdateKeysBNBCryptoDataByIdParams) (BnbCryptoDatum, error)

func (*Queries) UpdateKeysBTCCryptoDataById added in v0.5.0

func (q *Queries) UpdateKeysBTCCryptoDataById(ctx context.Context, arg UpdateKeysBTCCryptoDataByIdParams) (BtcCryptoDatum, error)

func (*Queries) UpdateKeysETHCryptoDataById added in v0.7.0

func (q *Queries) UpdateKeysETHCryptoDataById(ctx context.Context, arg UpdateKeysETHCryptoDataByIdParams) (EthCryptoDatum, error)

func (*Queries) UpdateKeysLTCCryptoDataById added in v0.6.0

func (q *Queries) UpdateKeysLTCCryptoDataById(ctx context.Context, arg UpdateKeysLTCCryptoDataByIdParams) (LtcCryptoDatum, 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 SetBNBCryptoDataByUserIdParams added in v0.8.0

type SetBNBCryptoDataByUserIdParams struct {
	UserID pgtype.UUID
	BnbID  pgtype.UUID
}

type SetBTCCryptoDataByUserIdParams added in v0.5.0

type SetBTCCryptoDataByUserIdParams struct {
	UserID pgtype.UUID
	BtcID  pgtype.UUID
}

type SetETHCryptoDataByUserIdParams added in v0.7.0

type SetETHCryptoDataByUserIdParams struct {
	UserID pgtype.UUID
	EthID  pgtype.UUID
}

type SetLTCCryptoDataByUserIdParams added in v0.6.0

type SetLTCCryptoDataByUserIdParams struct {
	UserID pgtype.UUID
	LtcID  pgtype.UUID
}

type SetXMRCryptoDataByUserIdParams

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

type UpdateCryptoCacheByCoinParams

type UpdateCryptoCacheByCoinParams struct {
	Coin                  CoinType
	LastSyncedBlockHeight pgtype.Int8
}

type UpdateIndicesBNBCryptoDataByIdParams added in v0.8.0

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

type UpdateIndicesBTCCryptoDataByIdParams added in v0.5.0

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

type UpdateIndicesETHCryptoDataByIdParams added in v0.7.0

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

type UpdateIndicesLTCCryptoDataByIdParams added in v0.6.0

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

type UpdateIndicesXMRCryptoDataByIdParams

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

type UpdateIsOccupiedByCryptoAddressParams

type UpdateIsOccupiedByCryptoAddressParams struct {
	Address    string
	IsOccupied bool
}

type UpdateKeysBNBCryptoDataByIdParams added in v0.8.0

type UpdateKeysBNBCryptoDataByIdParams struct {
	ID           pgtype.UUID
	MasterPubKey string
}

type UpdateKeysBTCCryptoDataByIdParams added in v0.5.0

type UpdateKeysBTCCryptoDataByIdParams struct {
	ID           pgtype.UUID
	MasterPubKey string
}

type UpdateKeysETHCryptoDataByIdParams added in v0.7.0

type UpdateKeysETHCryptoDataByIdParams struct {
	ID           pgtype.UUID
	MasterPubKey string
}

type UpdateKeysLTCCryptoDataByIdParams added in v0.6.0

type UpdateKeysLTCCryptoDataByIdParams struct {
	ID           pgtype.UUID
	MasterPubKey string
}

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