utils

package
v0.0.0-...-d0dd730 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Flags = flag.NewFlagSet("goose", flag.ExitOnError)
	DB    *sql.DB
)

Global vars

Functions

func CreateNewDB

func CreateNewDB() error

CreateNewDB creates a new db conn

func GetCurrencyByCode

func GetCurrencyByCode(code string, issuer string, insertIfNotFound bool) (currency *models.Currency, err error)

GetCurrencyByCode returns currency model if exists, if not and the flag is set it adds the currency and returns it

func GetCurrentRate

func GetCurrentRate(sourceCurrency *models.Currency, destinationCurrency *models.Currency) (lastTransaction *models.CurrentChartDataMinutely, err error)

GetCurrentRate returns latest exchange available between 2 currencies

func GetSchemaForQuery

func GetSchemaForQuery() string

GetSchemaForQuery returns string to use as schema inside queries

func HandlePanic

func HandlePanic(function string, message string)

HandlePanic general panic handler

func InsertCurrencyToDB

func InsertCurrencyToDB(currencyCode string, currencyIssuer string) error

InsertCurrencyToDB adds new currency to db

func TruncateHistoryTable

func TruncateHistoryTable() error

TruncateHistoryTable deletes the history data from the db

Types

This section is empty.

Jump to

Keyboard shortcuts

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