repository

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

func BigIntToNumeric ¶

func BigIntToNumeric(bigInt *big.Int) pgtype.Numeric

func Int64ToNullable ¶

func Int64ToNullable(i int64) sql.NullInt64

func MoneyToNegNumeric ¶

func MoneyToNegNumeric(m money.Money) pgtype.Numeric

func MoneyToNumeric ¶

func MoneyToNumeric(m money.Money) pgtype.Numeric

func NullTimeToPointer ¶

func NullTimeToPointer(t sql.NullTime) *time.Time

func NullableInt64ToPointer ¶

func NullableInt64ToPointer(i sql.NullInt64) *int64

func NullableStringToPointer ¶

func NullableStringToPointer(s sql.NullString) *string

func NumericToBigInt ¶

func NumericToBigInt(num pgtype.Numeric) (*big.Int, error)

func NumericToCrypto ¶ added in v0.3.0

func NumericToCrypto(num pgtype.Numeric, currency money.CryptoCurrency) (money.Money, error)

func NumericToMoney ¶

func NumericToMoney(num pgtype.Numeric, moneyType money.Type, ticker string, decimals int64) (money.Money, error)

func PointerInt64ToNullable ¶

func PointerInt64ToNullable(i *int64) sql.NullInt64

func PointerStringToNullable ¶

func PointerStringToNullable(s *string) sql.NullString

func StringToNullable ¶

func StringToNullable(s string) sql.NullString

func TimeToNullable ¶

func TimeToNullable(t time.Time) sql.NullTime

Types ¶

type ApiToken ¶

type ApiToken struct {
	ID         int64
	EntityType string
	EntityID   int64
	CreatedAt  time.Time
	Token      string
	Name       sql.NullString
	Settings   pgtype.JSONB
	Uuid       uuid.UUID
}

type Balance ¶

type Balance struct {
	ID           int64
	CreatedAt    time.Time
	UpdatedAt    time.Time
	EntityID     int64
	EntityType   string
	Network      string
	NetworkID    string
	CurrencyType string
	Currency     string
	Decimals     int32
	Amount       pgtype.Numeric
	Uuid         uuid.NullUUID
}

type BalanceAuditLog ¶

type BalanceAuditLog struct {
	ID        int64
	CreatedAt time.Time
	BalanceID int64
	Comment   string
	Metadata  pgtype.JSONB
}

type CalculateCustomerPaymentsParams ¶

type CalculateCustomerPaymentsParams struct {
	MerchantID int64
	CustomerID sql.NullInt64
	Status     string
}

type CancelTransactionParams ¶

type CancelTransactionParams struct {
	ID            int64
	Status        string
	UpdatedAt     time.Time
	Metadata      pgtype.JSONB
	NetworkFee    pgtype.Numeric
	SetNetworkFee bool
}

type CreateAPITokenParams ¶

type CreateAPITokenParams struct {
	EntityType string
	EntityID   int64
	CreatedAt  time.Time
	Token      string
	Uuid       uuid.UUID
	Name       sql.NullString
	Settings   pgtype.JSONB
}

type CreateBalanceParams ¶

type CreateBalanceParams struct {
	CreatedAt    time.Time
	UpdatedAt    time.Time
	EntityID     int64
	EntityType   string
	Uuid         uuid.NullUUID
	Network      string
	NetworkID    string
	CurrencyType string
	Currency     string
	Decimals     int32
	Amount       pgtype.Numeric
}

type CreateCustomerParams ¶

type CreateCustomerParams struct {
	Uuid       uuid.UUID
	CreatedAt  time.Time
	UpdatedAt  time.Time
	Email      sql.NullString
	MerchantID int64
}

type CreateJobLogParams ¶

type CreateJobLogParams struct {
	CreatedAt time.Time
	Level     int16
	JobID     sql.NullString
	Message   string
	Metadata  pgtype.JSONB
}

type CreateMerchantAddressParams ¶

type CreateMerchantAddressParams struct {
	CreatedAt  time.Time
	UpdatedAt  time.Time
	Uuid       uuid.UUID
	MerchantID int64
	Name       string
	Blockchain string
	Address    string
}

type CreateMerchantParams ¶

type CreateMerchantParams struct {
	Uuid      uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt sql.NullTime
	Name      string
	Website   string
	CreatorID int64
	Settings  pgtype.JSONB
}

type CreatePaymentLinkParams ¶

type CreatePaymentLinkParams struct {
	Uuid           uuid.UUID
	Slug           string
	CreatedAt      time.Time
	UpdatedAt      time.Time
	MerchantID     int64
	Name           string
	Description    string
	Price          pgtype.Numeric
	Decimals       int32
	Currency       string
	SuccessAction  string
	RedirectUrl    sql.NullString
	SuccessMessage sql.NullString
	IsTest         bool
}

type CreatePaymentParams ¶

type CreatePaymentParams struct {
	PublicID          uuid.UUID
	CreatedAt         time.Time
	UpdatedAt         time.Time
	Type              string
	Status            string
	MerchantID        int64
	MerchantOrderUuid uuid.UUID
	MerchantOrderID   sql.NullString
	ExpiresAt         sql.NullTime
	Price             pgtype.Numeric
	Decimals          int32
	Currency          string
	Description       sql.NullString
	RedirectUrl       string
	Metadata          pgtype.JSONB
	IsTest            bool
}

type CreateRegistryItemParams ¶

type CreateRegistryItemParams struct {
	CreatedAt   time.Time
	UpdatedAt   time.Time
	MerchantID  int64
	Key         string
	Value       string
	Description string
}

type CreateTransactionParams ¶

type CreateTransactionParams struct {
	MerchantID        int64
	CreatedAt         time.Time
	UpdatedAt         time.Time
	Status            string
	Type              string
	EntityID          sql.NullInt64
	SenderWalletID    sql.NullInt64
	SenderAddress     sql.NullString
	RecipientWalletID sql.NullInt64
	RecipientAddress  string
	TransactionHash   sql.NullString
	Blockchain        string
	NetworkID         sql.NullString
	CurrencyType      string
	Currency          string
	Decimals          int32
	NetworkDecimals   int32
	Amount            pgtype.Numeric
	FactAmount        pgtype.Numeric
	NetworkFee        pgtype.Numeric
	ServiceFee        pgtype.Numeric
	UsdAmount         pgtype.Numeric
	Metadata          pgtype.JSONB
	IsTest            bool
}

type CreateUserParams ¶

type CreateUserParams struct {
	Name            string
	Email           string
	Password        sql.NullString
	Uuid            uuid.UUID
	GoogleID        sql.NullString
	ProfileImageUrl sql.NullString
	CreatedAt       time.Time
	UpdatedAt       time.Time
	DeletedAt       sql.NullTime
	Settings        pgtype.JSONB
}

type CreateWalletLockParams ¶

type CreateWalletLockParams struct {
	MerchantID  int64
	WalletID    int64
	Currency    string
	NetworkID   string
	LockedAt    time.Time
	LockedUntil sql.NullTime
}

type CreateWalletParams ¶

type CreateWalletParams struct {
	CreatedAt  time.Time
	Uuid       uuid.UUID
	Address    string
	Blockchain string
	Type       sql.NullString
}

type Customer ¶

type Customer struct {
	ID         int64
	Uuid       uuid.UUID
	CreatedAt  time.Time
	UpdatedAt  time.Time
	Email      sql.NullString
	MerchantID int64
}

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 DeleteMerchantAddressParams ¶

type DeleteMerchantAddressParams struct {
	MerchantID int64
	ID         int64
}

type DeletePaymentLinkByPublicIDParams ¶

type DeletePaymentLinkByPublicIDParams struct {
	MerchantID int64
	Uuid       uuid.UUID
}

type EagerLoadTransactionsByPaymentIDParams ¶

type EagerLoadTransactionsByPaymentIDParams struct {
	MerchantID int64
	EntityIds  []int32
	Type       []string
}

type GetAPITokenParams ¶

type GetAPITokenParams struct {
	EntityType string
	Token      string
}

type GetAvailableWalletParams ¶

type GetAvailableWalletParams struct {
	Blockchain string
	Type       sql.NullString
	Currency   string
	NetworkID  string
}

type GetBalanceByFilterParams ¶

type GetBalanceByFilterParams struct {
	EntityID   int64
	EntityType string
	NetworkID  string
	Currency   string
}

type GetBalanceByFilterWithLockParams ¶

type GetBalanceByFilterWithLockParams struct {
	EntityID   int64
	EntityType string
	NetworkID  string
	Currency   string
}

type GetBalanceByIDParams ¶

type GetBalanceByIDParams struct {
	EntityID   int64
	EntityType string
	ID         int64
}

type GetBalanceByUUIDParams ¶

type GetBalanceByUUIDParams struct {
	EntityID   int64
	EntityType string
	Uuid       uuid.NullUUID
}

type GetBatchCustomersParams ¶

type GetBatchCustomersParams struct {
	MerchantID int64
	Ids        []int32
}

type GetBatchExpiredPaymentsParams ¶

type GetBatchExpiredPaymentsParams struct {
	Limit     int32
	ExpiresAt sql.NullTime
	CreatedAt time.Time
	Type      string
	Status    []string
}

type GetCustomerByEmailParams ¶

type GetCustomerByEmailParams struct {
	Email      sql.NullString
	MerchantID int64
}

type GetCustomerByIDParams ¶

type GetCustomerByIDParams struct {
	ID         int64
	MerchantID int64
}

type GetCustomerByUUIDParams ¶

type GetCustomerByUUIDParams struct {
	Uuid       uuid.UUID
	MerchantID int64
}

type GetMerchantAddressByAddressParams ¶

type GetMerchantAddressByAddressParams struct {
	MerchantID int64
	Address    string
	Blockchain string
}

type GetMerchantAddressByIDParams ¶

type GetMerchantAddressByIDParams struct {
	MerchantID int64
	ID         int64
}

type GetMerchantAddressByUUIDParams ¶

type GetMerchantAddressByUUIDParams struct {
	MerchantID int64
	Uuid       uuid.UUID
}

type GetMerchantByIDParams ¶

type GetMerchantByIDParams struct {
	ID          int64
	WithTrashed bool
}

type GetMerchantByUUIDAndCreatorIDParams ¶

type GetMerchantByUUIDAndCreatorIDParams struct {
	Uuid        uuid.UUID
	CreatorID   int64
	WithTrashed bool
}

type GetMerchantByUUIDParams ¶

type GetMerchantByUUIDParams struct {
	Uuid        uuid.UUID
	WithTrashed bool
}

type GetPaymentByIDParams ¶

type GetPaymentByIDParams struct {
	ID                 int64
	MerchantID         int64
	FilterByMerchantID bool
}

type GetPaymentByMerchantIDAndOrderUUIDParams ¶

type GetPaymentByMerchantIDAndOrderUUIDParams struct {
	MerchantID        int64
	MerchantOrderUuid uuid.UUID
}

type GetPaymentByMerchantIDsParams ¶

type GetPaymentByMerchantIDsParams struct {
	MerchantID        int64
	MerchantOrderUuid uuid.UUID
}

type GetPaymentLinkByIDParams ¶

type GetPaymentLinkByIDParams struct {
	MerchantID int64
	ID         int64
}

type GetPaymentLinkByPublicIDParams ¶

type GetPaymentLinkByPublicIDParams struct {
	MerchantID int64
	Uuid       uuid.UUID
}

type GetPaymentsByTypeParams ¶

type GetPaymentsByTypeParams struct {
	Type        string
	Status      string
	Limit       int32
	FilterByIds bool
	ID          []int32
}

type GetRecentCustomerPaymentsParams ¶

type GetRecentCustomerPaymentsParams struct {
	MerchantID int64
	CustomerID sql.NullInt64
	Limit      int32
}

type GetRegistryItemByKeyParams ¶

type GetRegistryItemByKeyParams struct {
	MerchantID int64
	Key        string
}

type GetTransactionByHashAndNetworkIDParams ¶

type GetTransactionByHashAndNetworkIDParams struct {
	TransactionHash sql.NullString
	NetworkID       sql.NullString
}

type GetTransactionByIDParams ¶

type GetTransactionByIDParams struct {
	ID                 int64
	MerchantID         int64
	FilterByMerchantID bool
}

type GetTransactionsByFilterParams ¶

type GetTransactionsByFilterParams struct {
	RecipientWalletID         sql.NullInt64
	NetworkID                 sql.NullString
	Currency                  string
	Limit                     int32
	FilterByRecipientWalletID bool
	FilterByNetworkID         bool
	FilterByCurrency          bool
	FilterByTypes             bool
	Types                     []string
	FilterByStatuses          bool
	Statuses                  []string
	FilterEmptyHash           bool
}

type GetWalletLockParams ¶

type GetWalletLockParams struct {
	WalletID  int64
	Currency  string
	NetworkID string
}

type InsertBalanceAuditLogParams ¶

type InsertBalanceAuditLogParams struct {
	CreatedAt time.Time
	BalanceID int64
	Comment   string
	Metadata  pgtype.JSONB
}

type JobLog ¶

type JobLog struct {
	ID        int64
	CreatedAt time.Time
	Level     int16
	JobID     sql.NullString
	Message   string
	Metadata  pgtype.JSONB
}

type ListAPITokensByEntityParams ¶

type ListAPITokensByEntityParams struct {
	EntityID   int64
	EntityType string
}

type ListAllBalancesByTypeParams ¶ added in v0.6.0

type ListAllBalancesByTypeParams struct {
	EntityType string
	HideEmpty  bool
}

type ListBalancesParams ¶

type ListBalancesParams struct {
	EntityType string
	EntityID   int64
}

type ListJobLogsByIDParams ¶

type ListJobLogsByIDParams struct {
	JobID sql.NullString
	Limit int32
}

type ListMerchantsByCreatorIDParams ¶

type ListMerchantsByCreatorIDParams struct {
	CreatorID   int64
	WithTrashed bool
}

type ListPaymentLinksParams ¶

type ListPaymentLinksParams struct {
	MerchantID int64
	Limit      int32
}

type Merchant ¶

type Merchant struct {
	ID        int64
	Uuid      uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt sql.NullTime
	Name      string
	Website   string
	CreatorID int64
	Settings  pgtype.JSONB
}

type MerchantAddress ¶

type MerchantAddress struct {
	ID         int64
	Uuid       uuid.UUID
	CreatedAt  time.Time
	UpdatedAt  time.Time
	MerchantID int64
	Name       string
	Blockchain string
	Address    string
}

type PaginateCustomersAscParams ¶

type PaginateCustomersAscParams struct {
	MerchantID int64
	ID         int64
	Limit      int32
}

type PaginateCustomersDescParams ¶

type PaginateCustomersDescParams struct {
	MerchantID int64
	ID         int64
	Limit      int32
}

type PaginatePaymentsAscParams ¶

type PaginatePaymentsAscParams struct {
	MerchantID    int64
	ID            int64
	Limit         int32
	FilterByTypes bool
	Type          []string
}

type PaginatePaymentsDescParams ¶

type PaginatePaymentsDescParams struct {
	MerchantID    int64
	ID            int64
	Limit         int32
	FilterByTypes bool
	Type          []string
}

type PaginateWalletsByIDParams ¶

type PaginateWalletsByIDParams struct {
	ID                 int64
	Limit              int32
	Blockchain         string
	Type               sql.NullString
	FilterByType       bool
	FilterByBlockchain bool
}

type Payment ¶

type Payment struct {
	ID                int64
	PublicID          uuid.UUID
	CreatedAt         time.Time
	UpdatedAt         time.Time
	Type              string
	Status            string
	MerchantID        int64
	MerchantOrderUuid uuid.UUID
	MerchantOrderID   sql.NullString
	ExpiresAt         sql.NullTime
	Price             pgtype.Numeric
	Decimals          int32
	Currency          string
	Description       sql.NullString
	RedirectUrl       string
	CustomerID        sql.NullInt64
	IsTest            bool
	WebhookSentAt     sql.NullTime
	Metadata          pgtype.JSONB
}
type PaymentLink struct {
	ID             int64
	Uuid           uuid.UUID
	Slug           string
	CreatedAt      time.Time
	UpdatedAt      time.Time
	MerchantID     int64
	Name           string
	Description    string
	Price          pgtype.Numeric
	Decimals       int32
	Currency       string
	SuccessAction  string
	RedirectUrl    sql.NullString
	SuccessMessage sql.NullString
	IsTest         bool
}

type Querier ¶

type Querier interface {
	AdvisoryTxLock(ctx context.Context, pgAdvisoryXactLock int64) error
	CalculateCustomerPayments(ctx context.Context, arg CalculateCustomerPaymentsParams) (int64, error)
	CancelTransaction(ctx context.Context, arg CancelTransactionParams) error
	CheckSystemWalletExistsByAddress(ctx context.Context, address string) (Wallet, error)
	CreateAPIToken(ctx context.Context, arg CreateAPITokenParams) (ApiToken, error)
	CreateBalance(ctx context.Context, arg CreateBalanceParams) (Balance, error)
	CreateCustomer(ctx context.Context, arg CreateCustomerParams) (Customer, error)
	CreateJobLog(ctx context.Context, arg CreateJobLogParams) error
	CreateMerchant(ctx context.Context, arg CreateMerchantParams) (Merchant, error)
	CreateMerchantAddress(ctx context.Context, arg CreateMerchantAddressParams) (MerchantAddress, error)
	CreatePayment(ctx context.Context, arg CreatePaymentParams) (Payment, error)
	CreatePaymentLink(ctx context.Context, arg CreatePaymentLinkParams) (PaymentLink, error)
	CreateRegistryItem(ctx context.Context, arg CreateRegistryItemParams) (Registry, error)
	CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	CreateWallet(ctx context.Context, arg CreateWalletParams) (Wallet, error)
	CreateWalletLock(ctx context.Context, arg CreateWalletLockParams) (WalletLock, error)
	DeleteAPITokenByID(ctx context.Context, id int64) error
	DeleteAPITokenByToken(ctx context.Context, token string) error
	DeleteMerchantAddress(ctx context.Context, arg DeleteMerchantAddressParams) error
	DeletePaymentLinkByPublicID(ctx context.Context, arg DeletePaymentLinkByPublicIDParams) error
	DeleteUser(ctx context.Context, id int64) error
	EagerLoadTransactionsByPaymentID(ctx context.Context, arg EagerLoadTransactionsByPaymentIDParams) ([]Transaction, error)
	GetAPIToken(ctx context.Context, arg GetAPITokenParams) (ApiToken, error)
	GetAPITokenByUUID(ctx context.Context, uuid uuid.UUID) (ApiToken, error)
	GetAvailableWallet(ctx context.Context, arg GetAvailableWalletParams) (Wallet, error)
	GetBalanceByFilter(ctx context.Context, arg GetBalanceByFilterParams) (Balance, error)
	GetBalanceByFilterWithLock(ctx context.Context, arg GetBalanceByFilterWithLockParams) (Balance, error)
	GetBalanceByID(ctx context.Context, arg GetBalanceByIDParams) (Balance, error)
	GetBalanceByIDWithLock(ctx context.Context, id int64) (Balance, error)
	GetBalanceByUUID(ctx context.Context, arg GetBalanceByUUIDParams) (Balance, error)
	GetBatchCustomers(ctx context.Context, arg GetBatchCustomersParams) ([]Customer, error)
	GetBatchExpiredPayments(ctx context.Context, arg GetBatchExpiredPaymentsParams) ([]Payment, error)
	GetCustomerByEmail(ctx context.Context, arg GetCustomerByEmailParams) (Customer, error)
	GetCustomerByID(ctx context.Context, arg GetCustomerByIDParams) (Customer, error)
	GetCustomerByUUID(ctx context.Context, arg GetCustomerByUUIDParams) (Customer, error)
	GetLatestTransactionByPaymentID(ctx context.Context, entityID sql.NullInt64) (Transaction, error)
	GetMerchantAddressByAddress(ctx context.Context, arg GetMerchantAddressByAddressParams) (MerchantAddress, error)
	GetMerchantAddressByID(ctx context.Context, arg GetMerchantAddressByIDParams) (MerchantAddress, error)
	GetMerchantAddressByUUID(ctx context.Context, arg GetMerchantAddressByUUIDParams) (MerchantAddress, error)
	GetMerchantByID(ctx context.Context, arg GetMerchantByIDParams) (Merchant, error)
	GetMerchantByUUID(ctx context.Context, arg GetMerchantByUUIDParams) (Merchant, error)
	GetMerchantByUUIDAndCreatorID(ctx context.Context, arg GetMerchantByUUIDAndCreatorIDParams) (Merchant, error)
	GetPaymentByID(ctx context.Context, arg GetPaymentByIDParams) (Payment, error)
	GetPaymentByMerchantIDAndOrderUUID(ctx context.Context, arg GetPaymentByMerchantIDAndOrderUUIDParams) (Payment, error)
	GetPaymentByMerchantIDs(ctx context.Context, arg GetPaymentByMerchantIDsParams) (Payment, error)
	GetPaymentByPublicID(ctx context.Context, publicID uuid.UUID) (Payment, error)
	GetPaymentLinkByID(ctx context.Context, arg GetPaymentLinkByIDParams) (PaymentLink, error)
	GetPaymentLinkByPublicID(ctx context.Context, arg GetPaymentLinkByPublicIDParams) (PaymentLink, error)
	GetPaymentLinkBySlug(ctx context.Context, slug string) (PaymentLink, error)
	GetPaymentsByType(ctx context.Context, arg GetPaymentsByTypeParams) ([]Payment, error)
	GetRecentCustomerPayments(ctx context.Context, arg GetRecentCustomerPaymentsParams) ([]Payment, error)
	GetRegistryItemByKey(ctx context.Context, arg GetRegistryItemByKeyParams) (Registry, error)
	GetTransactionByHashAndNetworkID(ctx context.Context, arg GetTransactionByHashAndNetworkIDParams) (Transaction, error)
	GetTransactionByID(ctx context.Context, arg GetTransactionByIDParams) (Transaction, error)
	GetTransactionsByFilter(ctx context.Context, arg GetTransactionsByFilterParams) ([]Transaction, error)
	GetUserByEmail(ctx context.Context, email string) (User, error)
	GetUserByGoogleID(ctx context.Context, googleID sql.NullString) (User, error)
	GetUserByID(ctx context.Context, id int64) (User, error)
	GetWalletByID(ctx context.Context, id int64) (Wallet, error)
	GetWalletByUUID(ctx context.Context, uuid uuid.UUID) (Wallet, error)
	GetWalletForUpdateByID(ctx context.Context, id int64) (Wallet, error)
	GetWalletLock(ctx context.Context, arg GetWalletLockParams) (WalletLock, error)
	InsertBalanceAuditLog(ctx context.Context, arg InsertBalanceAuditLogParams) error
	ListAPITokensByEntity(ctx context.Context, arg ListAPITokensByEntityParams) ([]ApiToken, error)
	ListAllBalancesByType(ctx context.Context, arg ListAllBalancesByTypeParams) ([]Balance, error)
	ListBalances(ctx context.Context, arg ListBalancesParams) ([]Balance, error)
	ListJobLogsByID(ctx context.Context, arg ListJobLogsByIDParams) ([]JobLog, error)
	ListMerchantAddresses(ctx context.Context, merchantID int64) ([]MerchantAddress, error)
	ListMerchantsByCreatorID(ctx context.Context, arg ListMerchantsByCreatorIDParams) ([]Merchant, error)
	ListPaymentLinks(ctx context.Context, arg ListPaymentLinksParams) ([]PaymentLink, error)
	ListUsers(ctx context.Context) ([]User, error)
	PaginateCustomersAsc(ctx context.Context, arg PaginateCustomersAscParams) ([]Customer, error)
	PaginateCustomersDesc(ctx context.Context, arg PaginateCustomersDescParams) ([]Customer, error)
	PaginatePaymentsAsc(ctx context.Context, arg PaginatePaymentsAscParams) ([]Payment, error)
	PaginatePaymentsDesc(ctx context.Context, arg PaginatePaymentsDescParams) ([]Payment, error)
	PaginateWalletsByID(ctx context.Context, arg PaginateWalletsByIDParams) ([]Wallet, error)
	ReleaseWalletLock(ctx context.Context, id int64) error
	SetTransactionHash(ctx context.Context, arg SetTransactionHashParams) error
	SoftDeleteMerchantByUUID(ctx context.Context, uuid uuid.UUID) error
	UpdateBalanceByID(ctx context.Context, arg UpdateBalanceByIDParams) (Balance, error)
	UpdateMerchant(ctx context.Context, arg UpdateMerchantParams) (Merchant, error)
	UpdateMerchantAddress(ctx context.Context, arg UpdateMerchantAddressParams) (MerchantAddress, error)
	UpdateMerchantSettings(ctx context.Context, arg UpdateMerchantSettingsParams) error
	UpdatePayment(ctx context.Context, arg UpdatePaymentParams) (Payment, error)
	UpdatePaymentCustomerID(ctx context.Context, arg UpdatePaymentCustomerIDParams) error
	UpdatePaymentWebhookInfo(ctx context.Context, arg UpdatePaymentWebhookInfoParams) error
	UpdateRegistryItem(ctx context.Context, arg UpdateRegistryItemParams) (Registry, error)
	UpdateTransaction(ctx context.Context, arg UpdateTransactionParams) (Transaction, error)
	UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)
	UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) (User, error)
	UpdateWalletMainnetTransactionCounters(ctx context.Context, arg UpdateWalletMainnetTransactionCountersParams) error
	UpdateWalletTatumFields(ctx context.Context, arg UpdateWalletTatumFieldsParams) (Wallet, error)
	UpdateWalletTestnetTransactionCounters(ctx context.Context, arg UpdateWalletTestnetTransactionCountersParams) error
}

type Queries ¶

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

func New ¶

func New(db DBTX) *Queries

func (*Queries) AdvisoryTransactionLock ¶

func (q *Queries) AdvisoryTransactionLock(ctx context.Context, pgAdvisoryXactLock int64) error

func (*Queries) AdvisoryTransactionUnlock ¶

func (q *Queries) AdvisoryTransactionUnlock(ctx context.Context, pgAdvisoryXactLock int64) error

func (*Queries) AdvisoryTxLock ¶

func (q *Queries) AdvisoryTxLock(ctx context.Context, pgAdvisoryXactLock int64) error

func (*Queries) CalculateCustomerPayments ¶

func (q *Queries) CalculateCustomerPayments(ctx context.Context, arg CalculateCustomerPaymentsParams) (int64, error)

func (*Queries) CancelTransaction ¶

func (q *Queries) CancelTransaction(ctx context.Context, arg CancelTransactionParams) error

func (*Queries) CheckSystemWalletExistsByAddress ¶

func (q *Queries) CheckSystemWalletExistsByAddress(ctx context.Context, address string) (Wallet, error)

func (*Queries) CreateAPIToken ¶

func (q *Queries) CreateAPIToken(ctx context.Context, arg CreateAPITokenParams) (ApiToken, error)

func (*Queries) CreateBalance ¶

func (q *Queries) CreateBalance(ctx context.Context, arg CreateBalanceParams) (Balance, error)

func (*Queries) CreateCustomer ¶

func (q *Queries) CreateCustomer(ctx context.Context, arg CreateCustomerParams) (Customer, error)

func (*Queries) CreateJobLog ¶

func (q *Queries) CreateJobLog(ctx context.Context, arg CreateJobLogParams) error

func (*Queries) CreateMerchant ¶

func (q *Queries) CreateMerchant(ctx context.Context, arg CreateMerchantParams) (Merchant, error)

func (*Queries) CreateMerchantAddress ¶

func (q *Queries) CreateMerchantAddress(ctx context.Context, arg CreateMerchantAddressParams) (MerchantAddress, error)

func (*Queries) CreatePayment ¶

func (q *Queries) CreatePayment(ctx context.Context, arg CreatePaymentParams) (Payment, error)
func (q *Queries) CreatePaymentLink(ctx context.Context, arg CreatePaymentLinkParams) (PaymentLink, error)

func (*Queries) CreateRegistryItem ¶

func (q *Queries) CreateRegistryItem(ctx context.Context, arg CreateRegistryItemParams) (Registry, error)

func (*Queries) CreateTransaction ¶

func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error)

func (*Queries) CreateUser ¶

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) CreateWallet ¶

func (q *Queries) CreateWallet(ctx context.Context, arg CreateWalletParams) (Wallet, error)

func (*Queries) CreateWalletLock ¶

func (q *Queries) CreateWalletLock(ctx context.Context, arg CreateWalletLockParams) (WalletLock, error)

func (*Queries) DeleteAPITokenByID ¶

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

func (*Queries) DeleteAPITokenByToken ¶

func (q *Queries) DeleteAPITokenByToken(ctx context.Context, token string) error

func (*Queries) DeleteMerchantAddress ¶

func (q *Queries) DeleteMerchantAddress(ctx context.Context, arg DeleteMerchantAddressParams) error

func (*Queries) DeletePaymentLinkByPublicID ¶

func (q *Queries) DeletePaymentLinkByPublicID(ctx context.Context, arg DeletePaymentLinkByPublicIDParams) error

func (*Queries) DeleteUser ¶

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

func (*Queries) EagerLoadTransactionsByPaymentID ¶

func (q *Queries) EagerLoadTransactionsByPaymentID(ctx context.Context, arg EagerLoadTransactionsByPaymentIDParams) ([]Transaction, error)

func (*Queries) GetAPIToken ¶

func (q *Queries) GetAPIToken(ctx context.Context, arg GetAPITokenParams) (ApiToken, error)

func (*Queries) GetAPITokenByUUID ¶

func (q *Queries) GetAPITokenByUUID(ctx context.Context, uuid uuid.UUID) (ApiToken, error)

func (*Queries) GetAvailableWallet ¶

func (q *Queries) GetAvailableWallet(ctx context.Context, arg GetAvailableWalletParams) (Wallet, error)

func (*Queries) GetBalanceByFilter ¶

func (q *Queries) GetBalanceByFilter(ctx context.Context, arg GetBalanceByFilterParams) (Balance, error)

func (*Queries) GetBalanceByFilterWithLock ¶

func (q *Queries) GetBalanceByFilterWithLock(ctx context.Context, arg GetBalanceByFilterWithLockParams) (Balance, error)

func (*Queries) GetBalanceByID ¶

func (q *Queries) GetBalanceByID(ctx context.Context, arg GetBalanceByIDParams) (Balance, error)

func (*Queries) GetBalanceByIDWithLock ¶

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

func (*Queries) GetBalanceByUUID ¶

func (q *Queries) GetBalanceByUUID(ctx context.Context, arg GetBalanceByUUIDParams) (Balance, error)

func (*Queries) GetBatchCustomers ¶

func (q *Queries) GetBatchCustomers(ctx context.Context, arg GetBatchCustomersParams) ([]Customer, error)

func (*Queries) GetBatchExpiredPayments ¶

func (q *Queries) GetBatchExpiredPayments(ctx context.Context, arg GetBatchExpiredPaymentsParams) ([]Payment, error)

func (*Queries) GetCustomerByEmail ¶

func (q *Queries) GetCustomerByEmail(ctx context.Context, arg GetCustomerByEmailParams) (Customer, error)

func (*Queries) GetCustomerByID ¶

func (q *Queries) GetCustomerByID(ctx context.Context, arg GetCustomerByIDParams) (Customer, error)

func (*Queries) GetCustomerByUUID ¶

func (q *Queries) GetCustomerByUUID(ctx context.Context, arg GetCustomerByUUIDParams) (Customer, error)

func (*Queries) GetLatestTransactionByPaymentID ¶

func (q *Queries) GetLatestTransactionByPaymentID(ctx context.Context, entityID sql.NullInt64) (Transaction, error)

func (*Queries) GetMerchantAddressByAddress ¶

func (q *Queries) GetMerchantAddressByAddress(ctx context.Context, arg GetMerchantAddressByAddressParams) (MerchantAddress, error)

func (*Queries) GetMerchantAddressByID ¶

func (q *Queries) GetMerchantAddressByID(ctx context.Context, arg GetMerchantAddressByIDParams) (MerchantAddress, error)

func (*Queries) GetMerchantAddressByUUID ¶

func (q *Queries) GetMerchantAddressByUUID(ctx context.Context, arg GetMerchantAddressByUUIDParams) (MerchantAddress, error)

func (*Queries) GetMerchantByID ¶

func (q *Queries) GetMerchantByID(ctx context.Context, arg GetMerchantByIDParams) (Merchant, error)

func (*Queries) GetMerchantByUUID ¶

func (q *Queries) GetMerchantByUUID(ctx context.Context, arg GetMerchantByUUIDParams) (Merchant, error)

func (*Queries) GetMerchantByUUIDAndCreatorID ¶

func (q *Queries) GetMerchantByUUIDAndCreatorID(ctx context.Context, arg GetMerchantByUUIDAndCreatorIDParams) (Merchant, error)

func (*Queries) GetPaymentByID ¶

func (q *Queries) GetPaymentByID(ctx context.Context, arg GetPaymentByIDParams) (Payment, error)

func (*Queries) GetPaymentByMerchantIDAndOrderUUID ¶

func (q *Queries) GetPaymentByMerchantIDAndOrderUUID(ctx context.Context, arg GetPaymentByMerchantIDAndOrderUUIDParams) (Payment, error)

func (*Queries) GetPaymentByMerchantIDs ¶

func (q *Queries) GetPaymentByMerchantIDs(ctx context.Context, arg GetPaymentByMerchantIDsParams) (Payment, error)

func (*Queries) GetPaymentByPublicID ¶

func (q *Queries) GetPaymentByPublicID(ctx context.Context, publicID uuid.UUID) (Payment, error)

func (*Queries) GetPaymentLinkByID ¶

func (q *Queries) GetPaymentLinkByID(ctx context.Context, arg GetPaymentLinkByIDParams) (PaymentLink, error)

func (*Queries) GetPaymentLinkByPublicID ¶

func (q *Queries) GetPaymentLinkByPublicID(ctx context.Context, arg GetPaymentLinkByPublicIDParams) (PaymentLink, error)

func (*Queries) GetPaymentLinkBySlug ¶

func (q *Queries) GetPaymentLinkBySlug(ctx context.Context, slug string) (PaymentLink, error)

func (*Queries) GetPaymentsByType ¶

func (q *Queries) GetPaymentsByType(ctx context.Context, arg GetPaymentsByTypeParams) ([]Payment, error)

func (*Queries) GetRecentCustomerPayments ¶

func (q *Queries) GetRecentCustomerPayments(ctx context.Context, arg GetRecentCustomerPaymentsParams) ([]Payment, error)

func (*Queries) GetRegistryItemByKey ¶

func (q *Queries) GetRegistryItemByKey(ctx context.Context, arg GetRegistryItemByKeyParams) (Registry, error)

func (*Queries) GetTransactionByHashAndNetworkID ¶

func (q *Queries) GetTransactionByHashAndNetworkID(ctx context.Context, arg GetTransactionByHashAndNetworkIDParams) (Transaction, error)

func (*Queries) GetTransactionByID ¶

func (q *Queries) GetTransactionByID(ctx context.Context, arg GetTransactionByIDParams) (Transaction, error)

func (*Queries) GetTransactionsByFilter ¶

func (q *Queries) GetTransactionsByFilter(ctx context.Context, arg GetTransactionsByFilterParams) ([]Transaction, error)

func (*Queries) GetUserByEmail ¶

func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)

func (*Queries) GetUserByGoogleID ¶

func (q *Queries) GetUserByGoogleID(ctx context.Context, googleID sql.NullString) (User, error)

func (*Queries) GetUserByID ¶

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

func (*Queries) GetWalletByID ¶

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

func (*Queries) GetWalletByUUID ¶

func (q *Queries) GetWalletByUUID(ctx context.Context, uuid uuid.UUID) (Wallet, error)

func (*Queries) GetWalletForUpdateByID ¶

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

func (*Queries) GetWalletLock ¶

func (q *Queries) GetWalletLock(ctx context.Context, arg GetWalletLockParams) (WalletLock, error)

func (*Queries) InsertBalanceAuditLog ¶

func (q *Queries) InsertBalanceAuditLog(ctx context.Context, arg InsertBalanceAuditLogParams) error

func (*Queries) ListAPITokensByEntity ¶

func (q *Queries) ListAPITokensByEntity(ctx context.Context, arg ListAPITokensByEntityParams) ([]ApiToken, error)

func (*Queries) ListAllBalancesByType ¶ added in v0.6.0

func (q *Queries) ListAllBalancesByType(ctx context.Context, arg ListAllBalancesByTypeParams) ([]Balance, error)

func (*Queries) ListBalances ¶

func (q *Queries) ListBalances(ctx context.Context, arg ListBalancesParams) ([]Balance, error)

func (*Queries) ListJobLogsByID ¶

func (q *Queries) ListJobLogsByID(ctx context.Context, arg ListJobLogsByIDParams) ([]JobLog, error)

func (*Queries) ListMerchantAddresses ¶

func (q *Queries) ListMerchantAddresses(ctx context.Context, merchantID int64) ([]MerchantAddress, error)

func (*Queries) ListMerchantsByCreatorID ¶

func (q *Queries) ListMerchantsByCreatorID(ctx context.Context, arg ListMerchantsByCreatorIDParams) ([]Merchant, error)
func (q *Queries) ListPaymentLinks(ctx context.Context, arg ListPaymentLinksParams) ([]PaymentLink, error)

func (*Queries) ListUsers ¶

func (q *Queries) ListUsers(ctx context.Context) ([]User, error)

func (*Queries) PaginateCustomersAsc ¶

func (q *Queries) PaginateCustomersAsc(ctx context.Context, arg PaginateCustomersAscParams) ([]Customer, error)

func (*Queries) PaginateCustomersDesc ¶

func (q *Queries) PaginateCustomersDesc(ctx context.Context, arg PaginateCustomersDescParams) ([]Customer, error)

func (*Queries) PaginatePaymentsAsc ¶

func (q *Queries) PaginatePaymentsAsc(ctx context.Context, arg PaginatePaymentsAscParams) ([]Payment, error)

func (*Queries) PaginatePaymentsDesc ¶

func (q *Queries) PaginatePaymentsDesc(ctx context.Context, arg PaginatePaymentsDescParams) ([]Payment, error)

func (*Queries) PaginateWalletsByID ¶

func (q *Queries) PaginateWalletsByID(ctx context.Context, arg PaginateWalletsByIDParams) ([]Wallet, error)

func (*Queries) ReleaseWalletLock ¶

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

func (*Queries) SetTransactionHash ¶

func (q *Queries) SetTransactionHash(ctx context.Context, arg SetTransactionHashParams) error

func (*Queries) SoftDeleteMerchantByUUID ¶

func (q *Queries) SoftDeleteMerchantByUUID(ctx context.Context, uuid uuid.UUID) error

func (*Queries) UpdateBalanceByID ¶

func (q *Queries) UpdateBalanceByID(ctx context.Context, arg UpdateBalanceByIDParams) (Balance, error)

func (*Queries) UpdateMerchant ¶

func (q *Queries) UpdateMerchant(ctx context.Context, arg UpdateMerchantParams) (Merchant, error)

func (*Queries) UpdateMerchantAddress ¶

func (q *Queries) UpdateMerchantAddress(ctx context.Context, arg UpdateMerchantAddressParams) (MerchantAddress, error)

func (*Queries) UpdateMerchantSettings ¶

func (q *Queries) UpdateMerchantSettings(ctx context.Context, arg UpdateMerchantSettingsParams) error

func (*Queries) UpdatePayment ¶

func (q *Queries) UpdatePayment(ctx context.Context, arg UpdatePaymentParams) (Payment, error)

func (*Queries) UpdatePaymentCustomerID ¶

func (q *Queries) UpdatePaymentCustomerID(ctx context.Context, arg UpdatePaymentCustomerIDParams) error

func (*Queries) UpdatePaymentWebhookInfo ¶

func (q *Queries) UpdatePaymentWebhookInfo(ctx context.Context, arg UpdatePaymentWebhookInfoParams) error

func (*Queries) UpdateRegistryItem ¶

func (q *Queries) UpdateRegistryItem(ctx context.Context, arg UpdateRegistryItemParams) (Registry, error)

func (*Queries) UpdateTransaction ¶

func (q *Queries) UpdateTransaction(ctx context.Context, arg UpdateTransactionParams) (Transaction, error)

func (*Queries) UpdateUser ¶

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)

func (*Queries) UpdateUserPassword ¶

func (q *Queries) UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) (User, error)

func (*Queries) UpdateWalletMainnetTransactionCounters ¶

func (q *Queries) UpdateWalletMainnetTransactionCounters(ctx context.Context, arg UpdateWalletMainnetTransactionCountersParams) error

func (*Queries) UpdateWalletTatumFields ¶

func (q *Queries) UpdateWalletTatumFields(ctx context.Context, arg UpdateWalletTatumFieldsParams) (Wallet, error)

func (*Queries) UpdateWalletTestnetTransactionCounters ¶

func (q *Queries) UpdateWalletTestnetTransactionCounters(ctx context.Context, arg UpdateWalletTestnetTransactionCountersParams) error

func (*Queries) WithTx ¶

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

type Registry ¶

type Registry struct {
	ID          int64
	CreatedAt   time.Time
	UpdatedAt   time.Time
	MerchantID  int64
	Key         string
	Value       string
	Description string
}

type SetTransactionHashParams ¶

type SetTransactionHashParams struct {
	TransactionHash sql.NullString
	UpdatedAt       time.Time
	ID              int64
	MerchantID      int64
}

type Storage ¶

type Storage interface {
	Querier
	RunTransaction(ctx context.Context, callback TxCallback) error
}

type Store ¶

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

Store combines features of a repo and db connection (e.g. transaction support)

func NewStore ¶

func NewStore(db *pg.Connection) *Store

NewStore Store constructor.

func (*Store) RunTransaction ¶

func (s *Store) RunTransaction(ctx context.Context, callback TxCallback) error

type Transaction ¶

type Transaction struct {
	ID                int64
	CreatedAt         time.Time
	UpdatedAt         time.Time
	MerchantID        int64
	Status            string
	Type              string
	EntityID          sql.NullInt64
	RecipientWalletID sql.NullInt64
	SenderAddress     sql.NullString
	RecipientAddress  string
	TransactionHash   sql.NullString
	Blockchain        string
	CurrencyType      string
	Currency          string
	Decimals          int32
	Amount            pgtype.Numeric
	FactAmount        pgtype.Numeric
	NetworkFee        pgtype.Numeric
	ServiceFee        pgtype.Numeric
	UsdAmount         pgtype.Numeric
	Metadata          pgtype.JSONB
	NetworkID         sql.NullString
	IsTest            bool
	NetworkDecimals   int32
	SenderWalletID    sql.NullInt64
}

type TxCallback ¶

type TxCallback func(context.Context, Querier) error

type UpdateBalanceByIDParams ¶

type UpdateBalanceByIDParams struct {
	ID        int64
	UpdatedAt time.Time
	Amount    pgtype.Numeric
}

type UpdateMerchantAddressParams ¶

type UpdateMerchantAddressParams struct {
	MerchantID int64
	ID         int64
	Name       string
	UpdatedAt  time.Time
}

type UpdateMerchantParams ¶

type UpdateMerchantParams struct {
	ID        int64
	UpdatedAt time.Time
	Name      string
	Website   string
}

type UpdateMerchantSettingsParams ¶

type UpdateMerchantSettingsParams struct {
	ID        int64
	UpdatedAt time.Time
	Settings  pgtype.JSONB
}

type UpdatePaymentCustomerIDParams ¶

type UpdatePaymentCustomerIDParams struct {
	CustomerID sql.NullInt64
	ID         int64
}

type UpdatePaymentParams ¶

type UpdatePaymentParams struct {
	ID           int64
	MerchantID   int64
	Status       string
	UpdatedAt    time.Time
	ExpiresAt    sql.NullTime
	SetExpiresAt bool
}

type UpdatePaymentWebhookInfoParams ¶

type UpdatePaymentWebhookInfoParams struct {
	ID            int64
	MerchantID    int64
	WebhookSentAt sql.NullTime
	UpdatedAt     time.Time
}

type UpdateRegistryItemParams ¶

type UpdateRegistryItemParams struct {
	Key         string
	MerchantID  int64
	UpdatedAt   time.Time
	Value       string
	Description string
}

type UpdateTransactionParams ¶

type UpdateTransactionParams struct {
	MerchantID       int64
	ID               int64
	Status           string
	UpdatedAt        time.Time
	SenderAddress    sql.NullString
	FactAmount       pgtype.Numeric
	TransactionHash  sql.NullString
	NetworkFee       pgtype.Numeric
	Metadata         pgtype.JSONB
	RemoveServiceFee bool
}

type UpdateUserParams ¶

type UpdateUserParams struct {
	ID              int64
	Name            string
	ProfileImageUrl sql.NullString
	GoogleID        sql.NullString
	UpdatedAt       time.Time
	SetGoogleID     bool
}

type UpdateUserPasswordParams ¶

type UpdateUserPasswordParams struct {
	ID        int64
	Password  sql.NullString
	UpdatedAt time.Time
}

type UpdateWalletMainnetTransactionCountersParams ¶

type UpdateWalletMainnetTransactionCountersParams struct {
	ID                           int64
	ConfirmedMainnetTransactions int64
	PendingMainnetTransactions   int64
}

type UpdateWalletTatumFieldsParams ¶

type UpdateWalletTatumFieldsParams struct {
	TatumMainnetSubscriptionID sql.NullString
	TatumTestnetSubscriptionID sql.NullString
	ID                         int64
}

type UpdateWalletTestnetTransactionCountersParams ¶

type UpdateWalletTestnetTransactionCountersParams struct {
	ID                           int64
	ConfirmedTestnetTransactions int64
	PendingTestnetTransactions   int64
}

type User ¶

type User struct {
	ID              int64
	Name            string
	Email           string
	Uuid            uuid.UUID
	GoogleID        sql.NullString
	ProfileImageUrl sql.NullString
	CreatedAt       time.Time
	UpdatedAt       time.Time
	DeletedAt       sql.NullTime
	Settings        pgtype.JSONB
	Password        sql.NullString
}

type Wallet ¶

type Wallet struct {
	ID                           int64
	CreatedAt                    time.Time
	Uuid                         uuid.UUID
	Address                      string
	Blockchain                   string
	TatumMainnetSubscriptionID   sql.NullString
	TatumTestnetSubscriptionID   sql.NullString
	Type                         sql.NullString
	ConfirmedMainnetTransactions int64
	PendingMainnetTransactions   int64
	PendingTestnetTransactions   int64
	ConfirmedTestnetTransactions int64
}

type WalletLock ¶

type WalletLock struct {
	ID          int64
	WalletID    int64
	MerchantID  int64
	Currency    string
	NetworkID   string
	LockedAt    time.Time
	LockedUntil sql.NullTime
}

Jump to

Keyboard shortcuts

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