models

package
v0.0.0-...-4014866 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(db *sql.DB) error

Init initiliazes all database tables.

func InitCurrency

func InitCurrency(db *sql.DB) error

InitCurrency initiliazes the tables needed for the currency system.

Types

type Currency

type Currency struct {
	UserID    string
	Amount    int
	DateAdded int
}

Currency is the type for holding currency info about a user.

func CreateCurrency

func CreateCurrency(db *sql.DB, amount int, userID string) (*Currency, error)

CreateCurrency creates and inserts a Currency.

func GetCurrency

func GetCurrency(db *sql.DB, userID string) (*Currency, error)

GetCurrency returns a specific currency

type CurrencyTransaction

type CurrencyTransaction struct {
	ID        int
	Amount    int
	UserID    string
	Reason    string
	DateAdded int
}

CurrencyTransaction is the type for keeping track of a transaction to a currency type.

func CreateCurrencyTransaction

func CreateCurrencyTransaction(db *sql.DB, amount int, userID, reason string) (*CurrencyTransaction, error)

CreateCurrencyTransaction will create and insert a new CurrencyTransaction.

Jump to

Keyboard shortcuts

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