database

package
v0.0.0-...-3ef2293 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Currency

type Currency struct {
	ID            int32
	Code          string
	Name          string
	DecimalPlaces int32
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

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 ExchangeRate

type ExchangeRate struct {
	BaseCurrencyID int32
	CurrencyID     int32
	ExchangeRate   float64
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type ExchangeRateHistory

type ExchangeRateHistory struct {
	ID             int32
	BaseCurrencyID int32
	CurrencyID     int32
	ExchangeRate   float64
	Timestamp      time.Time
	CreatedAt      time.Time
}

type GetExchangeRateHistoryParams

type GetExchangeRateHistoryParams struct {
	BaseCurrencyCode   string
	TargetCurrencyCode string
	StartTime          time.Time
	EndTime            time.Time
}

type GetExchangeRateHistoryRow

type GetExchangeRateHistoryRow struct {
	Rate               float64
	Timestamp          time.Time
	BaseCurrencyCode   string
	TargetCurrencyCode string
}

type GetExchangeRateParams

type GetExchangeRateParams struct {
	BaseCurrencyCode   string
	TargetCurrencyCode string
}

type GetExchangeRateRow

type GetExchangeRateRow struct {
	ExchangeRate       float64
	CreatedAt          time.Time
	UpdatedAt          time.Time
	BaseCurrencyCode   string
	TargetCurrencyCode string
}

type InsertCurrencyParams

type InsertCurrencyParams struct {
	Code          string
	Name          string
	DecimalPlaces int32
}

type InsertExchangeRateHistoryParams

type InsertExchangeRateHistoryParams struct {
	BaseCurrencyCode   string
	TargetCurrencyCode string
	ExchangeRate       float64
}

type InsertPivotCurrencyParams

type InsertPivotCurrencyParams struct {
	CurrencyID int32
	Priority   int32
}

type PivotCurrency

type PivotCurrency struct {
	ID         int32
	CurrencyID int32
	Priority   int32
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) GetCurrencyIdByCode

func (q *Queries) GetCurrencyIdByCode(ctx context.Context, code string) (int32, error)

func (*Queries) GetExchangeRate

func (q *Queries) GetExchangeRate(ctx context.Context, arg GetExchangeRateParams) (GetExchangeRateRow, error)

func (*Queries) GetExchangeRateHistory

func (q *Queries) GetExchangeRateHistory(ctx context.Context, arg GetExchangeRateHistoryParams) ([]GetExchangeRateHistoryRow, error)

func (*Queries) GetPivotIdByCurrencyId

func (q *Queries) GetPivotIdByCurrencyId(ctx context.Context, currencyID int32) (int32, error)

func (*Queries) GetSupportedCurrencies

func (q *Queries) GetSupportedCurrencies(ctx context.Context) ([]string, error)

func (*Queries) InsertCurrency

func (q *Queries) InsertCurrency(ctx context.Context, arg InsertCurrencyParams) error

func (*Queries) InsertExchangeRateHistory

func (q *Queries) InsertExchangeRateHistory(ctx context.Context, arg InsertExchangeRateHistoryParams) error

func (*Queries) InsertPivotCurrency

func (q *Queries) InsertPivotCurrency(ctx context.Context, arg InsertPivotCurrencyParams) error

func (*Queries) UpsertExchangeRate

func (q *Queries) UpsertExchangeRate(ctx context.Context, arg UpsertExchangeRateParams) error

func (*Queries) WithTx

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

type UpsertExchangeRateParams

type UpsertExchangeRateParams struct {
	BaseCurrencyID int32
	CurrencyID     int32
	ExchangeRate   float64
	UpdatedAt      time.Time
}

Jump to

Keyboard shortcuts

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