accessors

package
v0.0.0-...-42acf81 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2016 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 AccessorGroup

type AccessorGroup struct {
	DB *sql.DB
}

AccessorGroup holds all configuration for the accessors.

func (*AccessorGroup) AddShares

func (ag *AccessorGroup) AddShares(userID string, symbol string, increase int)

AddShares adds a number of shares of a symbol to the given user

func (*AccessorGroup) AddTurnips

func (ag *AccessorGroup) AddTurnips(userID string, increase int)

AddTurnips adds a given number of turnips to the given userID

func (*AccessorGroup) ConnectToDB

func (c *AccessorGroup) ConnectToDB(dbType, dsn string)

ConnectToDB creates a database connection and sets it in the struct

func (*AccessorGroup) GetAllShares

func (ag *AccessorGroup) GetAllShares(userID string) []models.Investment

GetAllShares returns all of the given user's investments

func (*AccessorGroup) GetAllUsers

func (ag *AccessorGroup) GetAllUsers() []*models.User

GetAllUsers returns an array of all users from the database

func (*AccessorGroup) GetPortfolio

func (ag *AccessorGroup) GetPortfolio(userID string) models.Portfolio

GetPortfolio gets the given user's portfolio

func (*AccessorGroup) GetShare

func (ag *AccessorGroup) GetShare(userID string, symbol string) int

GetShare gets the given user's investment in a given symbol

func (*AccessorGroup) GetUser

func (ag *AccessorGroup) GetUser(userID string) *models.User

GetUser returns a user from the database by userID

func (*AccessorGroup) MakeUser

func (ag *AccessorGroup) MakeUser(userID string, username string)

MakeUser adds a user to the database

func (*AccessorGroup) SubtractShares

func (ag *AccessorGroup) SubtractShares(userID string, symbol string, decrease int) int

SubtractShares removes a certain number of given shares from the user and returns the new quantity

func (*AccessorGroup) SubtractTurnips

func (ag *AccessorGroup) SubtractTurnips(userID string, decrease int)

SubtractTurnips removes a given number of turnips from the given user

Jump to

Keyboard shortcuts

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