db

package
v0.0.0-...-ea4a80c Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Init exposed to init for test

Types

type AlreadyExist

type AlreadyExist struct {
	Obj interface{}
}

func (AlreadyExist) Error

func (e AlreadyExist) Error() string

type Instrument

type Instrument struct {
	Id          int
	Exchange    string
	Symbol      string
	Description string
}

func GetInstrument

func GetInstrument(exchange string, symbol string) (*Instrument, error)

func (*Instrument) Save

func (i *Instrument) Save() error

type InstrumentStr

type InstrumentStr string

func (InstrumentStr) Exchange

func (s InstrumentStr) Exchange() string

func (InstrumentStr) Symbol

func (s InstrumentStr) Symbol() string

type Label

type Label struct {
	Id     int
	UserId int
	Name   string
	Data   string
}

func (*Label) NewTransaction

func (l *Label) NewTransaction(tx request.Transaction) (*Transaction, error)

func (*Label) Save

func (l *Label) Save() error

func (*Label) Snapshot

func (l *Label) Snapshot() (*Snapshot, error)

type NotExist

type NotExist struct {
	Obj interface{}
}

func (NotExist) Error

func (e NotExist) Error() string

type Snapshot

type Snapshot struct {
	Id         int
	Label      Label
	Instrument Instrument
	Quantity   float64
	Price      float64
}

type Transaction

type Transaction struct {
	Id           int
	LabelId      int
	InstrumentId int
	Date         time.Time
	Type         int
	Quantity     float64
	Price        float64
	Value        float64
}

func (*Transaction) Save

func (t *Transaction) Save() error

func (*Transaction) UpdateSnapshot

func (t *Transaction) UpdateSnapshot() (*Snapshot, error)

type User

type User struct {
	Id       int
	Name     string
	Password string
}

func GetUser

func GetUser(name string) (*User, error)

func GetUserById

func GetUserById(id int) (*User, error)

func (*User) GetLabel

func (u *User) GetLabel(label string) (*Label, error)

func (*User) NewLabel

func (u *User) NewLabel(label request.Label) *Label

func (*User) Save

func (u *User) Save() error

Jump to

Keyboard shortcuts

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