models

package
v0.0.0-...-1775ad9 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB stores the session and model methods are defined on it

func Connect

func Connect(hosts ...string) (*DB, error)

Connect opens a new DB session

func (*DB) Disconnect

func (db *DB) Disconnect()

Disconnect closes the DB session

func (*DB) GetAccountsForUser

func (db *DB) GetAccountsForUser(ctx context.Context, userID gocql.UUID) ([]string, error)

GetAccountsForUser returns all accounts for a user

func (*DB) GetSession

func (db *DB) GetSession() *gocql.Session

GetSession return session to satisfy HasSession interface

func (*DB) GetUserDailyRecordsForPeriod

func (db *DB) GetUserDailyRecordsForPeriod(ctx context.Context, userID gocql.UUID, accounts []string, period *Period) <-chan *DailyPortfolioStatsWithError

GetUserDailyRecordsForPeriod returns

func (*DB) Init

func (db *DB) Init() error

Init creates missing tables and fills in default values

func (*DB) SetSession

func (db *DB) SetSession(session *gocql.Session) error

SetSession sets the session to satisfy HasSession interface

type DailyPortfolioStatsWithError

type DailyPortfolioStatsWithError struct {
	Record *models.DailyPortfolioStats
	Error  error
}

DailyPortfolioStatsWithError contains DailyPortfolioStats record bundled with an error

type Period

type Period struct {
	Start time.Time
	End   time.Time
}

Period contains a start and an end

Jump to

Keyboard shortcuts

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