data

package
v0.0.0-...-43207eb Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstPaymentOperationID

func FirstPaymentOperationID(payments []Payment) string

func InsertTestPayments

func InsertTestPayments(t *testing.T, ctx context.Context, payments []Payment, connectionPool db.ConnectionPool)

func LastPaymentOperationID

func LastPaymentOperationID(payments []Payment) string

func PrepareNamedQuery

func PrepareNamedQuery(ctx context.Context, connectionPool db.ConnectionPool, namedQuery string, argsMap map[string]interface{}) (string, []interface{}, error)

PrepareNamedQuery prepares the given query replacing the named parameters with Postgres' bindvars. It returns an SQL Injection-safe query and the arguments array to be used alongside it.

Types

type AccountModel

type AccountModel struct {
	DB db.ConnectionPool
}

func (*AccountModel) Delete

func (m *AccountModel) Delete(ctx context.Context, address string) error

func (*AccountModel) Insert

func (m *AccountModel) Insert(ctx context.Context, address string) error

func (*AccountModel) IsAccountFeeBumpEligible

func (m *AccountModel) IsAccountFeeBumpEligible(ctx context.Context, address string) (bool, error)

IsAccountFeeBumpEligible checks whether an account is eligible to have its transaction fee-bumped. Channel Accounts should be eligible because some of the transactions will have the channel accounts as the source account (i. e. create account sponsorship).

type Models

type Models struct {
	Payments *PaymentModel
	Account  *AccountModel
}

func NewModels

func NewModels(db db.ConnectionPool) (*Models, error)

type Payment

type Payment struct {
	OperationID     string    `db:"operation_id" json:"operationId"`
	OperationType   string    `db:"operation_type" json:"operationType"`
	TransactionID   string    `db:"transaction_id" json:"transactionId"`
	TransactionHash string    `db:"transaction_hash" json:"transactionHash"`
	FromAddress     string    `db:"from_address" json:"fromAddress"`
	ToAddress       string    `db:"to_address" json:"toAddress"`
	SrcAssetCode    string    `db:"src_asset_code" json:"srcAssetCode"`
	SrcAssetIssuer  string    `db:"src_asset_issuer" json:"srcAssetIssuer"`
	SrcAssetType    string    `db:"src_asset_type" json:"srcAssetType"`
	SrcAmount       int64     `db:"src_amount" json:"srcAmount"`
	DestAssetCode   string    `db:"dest_asset_code" json:"destAssetCode"`
	DestAssetIssuer string    `db:"dest_asset_issuer" json:"destAssetIssuer"`
	DestAssetType   string    `db:"dest_asset_type" json:"destAssetType"`
	DestAmount      int64     `db:"dest_amount" json:"destAmount"`
	CreatedAt       time.Time `db:"created_at" json:"createdAt"`
	Memo            *string   `db:"memo" json:"memo"`
	MemoType        string    `db:"memo_type" json:"memoType"`
}

type PaymentModel

type PaymentModel struct {
	DB db.ConnectionPool
}

func (*PaymentModel) AddPayment

func (m *PaymentModel) AddPayment(ctx context.Context, tx db.Transaction, payment Payment) error

func (*PaymentModel) GetLatestLedgerSynced

func (m *PaymentModel) GetLatestLedgerSynced(ctx context.Context, cursorName string) (uint32, error)

func (*PaymentModel) GetPaymentsPaginated

func (m *PaymentModel) GetPaymentsPaginated(ctx context.Context, address string, beforeID, afterID string, sort SortOrder, limit int) ([]Payment, bool, bool, error)

func (*PaymentModel) UpdateLatestLedgerSynced

func (m *PaymentModel) UpdateLatestLedgerSynced(ctx context.Context, cursorName string, ledger uint32) error

type SortOrder

type SortOrder string
const (
	ASC  SortOrder = "ASC"
	DESC SortOrder = "DESC"
)

func (SortOrder) IsValid

func (o SortOrder) IsValid() bool

Jump to

Keyboard shortcuts

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