mysql

package
v0.0.0-...-819fda8 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore struct {
	HashCost int
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, host, username, password, dbName string, port, hashCost int) (*DataStore, error)

func (*DataStore) AddPosition

func (store *DataStore) AddPosition(userId uint64, symbol string, qty decimal.Decimal, basis decimal.Decimal, boughtAt time.Time) error

func (*DataStore) AddUser

func (store *DataStore) AddUser(email, password string) error

AddUser inserts a new user record by hashing the given password.

func (*DataStore) GetPositionsBySymbol

func (store *DataStore) GetPositionsBySymbol(userId uint64, symbol string) ([]datalayer.Position, error)

func (*DataStore) GetPositionsByUser

func (store *DataStore) GetPositionsByUser(userId uint64) ([]datalayer.Position, error)

func (*DataStore) GetUserByEmail

func (store *DataStore) GetUserByEmail(email string) (*datalayer.User, error)

GetUserByEmail fetches a user record from the DB

Jump to

Keyboard shortcuts

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