datalayer

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashAndSalt

func HashAndSalt(pwd string, cost int) (string, error)

Types

type Position

type Position struct {
	ID        uint64
	UserID    uint64
	Symbol    string
	Qty       decimal.Decimal
	Basis     decimal.Decimal
	BoughtAt  time.Time
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (Position) BasisTotal

func (p Position) BasisTotal() decimal.Decimal

func (Position) GainAmount

func (p Position) GainAmount(priceEach decimal.Decimal) decimal.Decimal

func (Position) Value

func (p Position) Value(priceEach decimal.Decimal) decimal.Decimal

type StockStore

type StockStore interface {
	AddUser(email, password string) error
	GetUserByEmail(email string) (*User, error)

	// Stock Positions
	GetPositionsByUser(userId uint64) ([]Position, error)
	AddPosition(userId uint64, symbol string, qty decimal.Decimal, basis decimal.Decimal, boughtAt time.Time) error
}

type User

type User struct {
	ID             uint64
	Email          string
	PasswordDigest string
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

func (*User) CheckPassword

func (u *User) CheckPassword(password string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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