db

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scrape

func Scrape() <-chan lotto.Result

Scrape archive for data

Types

type AppDB

type AppDB struct {
	*sql.DB
}

AppDB is a wrapper for *sql.DB so I can extend it by adding my own methods

func Connect

func Connect(path string) *AppDB

Connect returns a DB connection wrapper

func (*AppDB) DataRange

func (db *AppDB) DataRange() (time.Time, time.Time, error)

DataRange retrieves the first and last record dates

func (*AppDB) Exists

func (db *AppDB) Exists(t time.Time) bool

Exists returns true if a record with t timestamp exists

func (*AppDB) LastDraw

func (db *AppDB) LastDraw() (lotto.Result, error)

LastDraw retrieves the most recent set of results

func (*AppDB) MachineSetFreq added in v0.0.6

func (db *AppDB) MachineSetFreq(begin time.Time, end time.Time) ([]MacSetFreq, error)

MachineSetFreq returns date constrained set displaying which combinations of machine/set have been drawn and how many times

func (*AppDB) Machines

func (db *AppDB) Machines(begin time.Time, end time.Time, sets []int) ([]string, error)

Machines returns the distinct machine names constrained by date and sets

func (*AppDB) Result

func (db *AppDB) Result(t time.Time) (lotto.Result, error)

Result retrieves a single record

func (*AppDB) Results

func (db *AppDB) Results(begin, end time.Time, machines []string, sets []int, orderDesc bool) <-chan lotto.Result

Results returns a channel of records

func (*AppDB) Sets

func (db *AppDB) Sets(begin time.Time, end time.Time, machines []string) ([]int, error)

Sets returns the distinct sets constrained by date and machines

func (*AppDB) Update

func (db *AppDB) Update() error

Update scrapes the archive site and adds newer records until an existing record is found.

type MacSetFreq added in v0.0.6

type MacSetFreq struct {
	Machine string
	Set     int
	Freq    int
}

MacSetFreq provides a struct for recording the frequency of a machine/set combination in draws

Jump to

Keyboard shortcuts

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