quotegetterdb

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToNullFloat64

func ToNullFloat64(f float64) sql.NullFloat64

ToNullFloat64 invalidates a sql.NullFloat64 if 0, validates otherwise

func ToNullString

func ToNullString(s string) sql.NullString

ToNullString invalidates a sql.NullString if empty, validates if not empty

func ToNullTime

func ToNullTime(t time.Time) sql.NullTime

ToNullTime invalidates a sql.NullTime if IsZero, validates otherwise

Types

type QuoteDatabase

type QuoteDatabase struct {
	// contains filtered or unexported fields
}

QuoteDatabase handles the database that store and retrieve quote informations.

func Open

func Open(dns string) (*QuoteDatabase, error)

Open the quote database. Try to create the database if not exists.

func (*QuoteDatabase) Close

func (qdb *QuoteDatabase) Close() error

Close the quote database

func (*QuoteDatabase) InsertQuotes

func (qdb *QuoteDatabase) InsertQuotes(items ...*QuoteRecord) error

InsertQuotes insert the quotes in the quotes database.

type QuoteRecord

type QuoteRecord struct {
	ID        int
	Isin      string
	Source    string
	Timestamp time.Time
	Date      time.Time
	Price     float32
	Currency  string
	URL       string
	ErrMsg    string
}

QuoteRecord is the record stored in the quote database.

func (*QuoteRecord) String

func (qr *QuoteRecord) String() string

Jump to

Keyboard shortcuts

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