repository

package
v0.0.0-...-cbdeaad Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SimpleUpsert

func SimpleUpsert[T schema.Tabler](tx *gorm.DB, data ...T) error

Types

type QueryFilter

type QueryFilter func(*gorm.DB) *gorm.DB

func ExistingPair

func ExistingPair() QueryFilter

func FromCoin

func FromCoin(coin string) QueryFilter

func Limit

func Limit(limit int) QueryFilter

func OrderBy

func OrderBy(columns ...string) QueryFilter

func Pair

func Pair(from, to string) QueryFilter

func ToCoin

func ToCoin(coin string) QueryFilter

func Type

func Type(t string) QueryFilter

type Repository

type Repository struct {
	DB         *db.DB
	ConfigFile *configfile.ConfigFile
	Logger     *log.Logger
}

func NewRepository

func NewRepository(db *db.DB, cf *configfile.ConfigFile, l *log.Logger) *Repository

func (*Repository) BlacklistSymbol

func (r *Repository) BlacklistSymbol(symbol string) error

func (*Repository) CleanCoinPriceHistory

func (r *Repository) CleanCoinPriceHistory() (inserted int64, deleted int64, err error)

func (*Repository) CleanOldPairHistory

func (r *Repository) CleanOldPairHistory() (inserted int64, deleted int64, err error)

func (*Repository) DeleteAllCoins

func (r *Repository) DeleteAllCoins(tx *gorm.DB) error

func (*Repository) DeleteAllDiff

func (r *Repository) DeleteAllDiff(tx *gorm.DB) error

func (*Repository) DisableCoin

func (r *Repository) DisableCoin(coin string) error

func (*Repository) GetAllCoins

func (r *Repository) GetAllCoins() ([]model.Coin, error)

func (*Repository) GetAvgLastPairRatioBetween

func (r *Repository) GetAvgLastPairRatioBetween(pairID uint, start, end time.Time) (decimal.Decimal, error)

func (*Repository) GetBalanceHistory

func (r *Repository) GetBalanceHistory() ([]model.BalanceHistory, error)

func (*Repository) GetBlacklistedSymbols

func (r *Repository) GetBlacklistedSymbols() ([]model.BlacklistedSymbol, error)

func (*Repository) GetBotFirstLaunch

func (r *Repository) GetBotFirstLaunch() (time.Time, error)

func (*Repository) GetCharts

func (r *Repository) GetCharts(modifiers ...QueryFilter) ([]model.Chart, error)

func (*Repository) GetCoinPricesSince

func (r *Repository) GetCoinPricesSince(coins []string, altCoin string, from time.Time) ([]model.CoinPrice, error)

func (*Repository) GetCoinsLastPrice

func (r *Repository) GetCoinsLastPrice(altCoin string) ([]model.CoinPrice, error)

func (*Repository) GetCurrentCoin

func (r *Repository) GetCurrentCoin() (model.CurrentCoin, bool, error)

func (*Repository) GetDefaultChartsWithBestDiff

func (r *Repository) GetDefaultChartsWithBestDiff() ([]model.Chart, error)

func (*Repository) GetDiff

func (r *Repository) GetDiff(filters ...QueryFilter) ([]model.Diff, error)

func (*Repository) GetEnabledCoins

func (r *Repository) GetEnabledCoins() ([]string, error)

func (*Repository) GetJumps

func (r *Repository) GetJumps(filters ...QueryFilter) ([]model.Jump, error)

func (*Repository) GetLastBalanceHistory

func (r *Repository) GetLastBalanceHistory() (model.BalanceHistory, error)

func (*Repository) GetLastPairRatiosBefore

func (r *Repository) GetLastPairRatiosBefore(t time.Time) ([]model.PairHistory, error)

func (*Repository) GetPairRatiosSince

func (r *Repository) GetPairRatiosSince(fromCoin, toCoin string, from time.Time) ([]model.PairHistory, error)

func (*Repository) GetPairs

func (r *Repository) GetPairs(filters ...QueryFilter) (map[string]model.Pair, error)

func (*Repository) LogCurrentCoin

func (r *Repository) LogCurrentCoin()

func (*Repository) ReplaceAllDiff

func (r *Repository) ReplaceAllDiff(computedDiff []model.Diff) error

func (*Repository) SaveNewCoinPriceChart

func (r *Repository) SaveNewCoinPriceChart(chartType string, coins []string, days string) (model.Chart, error)

func (*Repository) SetCurrentCoin

func (r *Repository) SetCurrentCoin(coin string, ts time.Time) (model.CurrentCoin, error)

func (*Repository) Vacuum

func (r *Repository) Vacuum() error

Jump to

Keyboard shortcuts

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