Documentation
¶
Index ¶
- func GetHardResetEntries(db DBWrapper) int
- func GetLastTemperatureEntry(db DBWrapper) int
- func GetPauseEntries(db DBWrapper) int
- func GetRainEntries(db DBWrapper) int
- func GetSoftResetEntries(db DBWrapper) int
- func GetUnpauseEntries(db DBWrapper) int
- func MakeHardResetEntry(db DBWrapper)
- func MakePauseEntry(db DBWrapper)
- func MakeRainTallyEntry(db DBWrapper)
- func MakeRainValueEntry(db DBWrapper, value float64)
- func MakeSoftResetEntry(db DBWrapper)
- func MakeTemperatureEntry(db DBWrapper, tempC int)
- func MakeUnpauseEntry(db DBWrapper)
- type Connection
- type DBWrapper
- type Sqlite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHardResetEntries ¶
GetHardResetEntries gets hard reset entries
func GetLastTemperatureEntry ¶
GetLastTemperatureEntry returns last temp reading, sorted by primary key
func GetSoftResetEntries ¶
GetSoftResetEntries gets soft reset entries
func GetUnpauseEntries ¶
GetUnpauseEntries gets pause entries
func MakeHardResetEntry ¶
func MakeHardResetEntry(db DBWrapper)
MakeHardResetEntry AddTag a hard reset event
func MakeRainTallyEntry ¶
func MakeRainTallyEntry(db DBWrapper)
MakeRainTallyEntry AddTag a rain event
func MakeRainValueEntry ¶
MakeRainValueEntry AddFloatRecord for a rain event
func MakeSoftResetEntry ¶
func MakeSoftResetEntry(db DBWrapper)
MakeSoftResetEntry AddTag a soft reset event
func MakeTemperatureEntry ¶
MakeTemperatureEntry AddTag a temperature measurement
func MakeUnpauseEntry ¶
func MakeUnpauseEntry(db DBWrapper)
MakeUnpauseEntry AddTag an unpause event
Types ¶
type Connection ¶
Connection gets a DB and Conn struct for a sqlite File
func (*Connection) Disconnect ¶
func (c *Connection) Disconnect()
Disconnect closes the connection to the database
type DBWrapper ¶
type DBWrapper interface { // MakeSchema initializes a schema MakeSchema() (sql.Result, error) // EnterData enters data into the database without returning any rows EnterData(cmd string) (sql.Result, error) // AddIntRecord makes a single integer entry into the database for a given tag AddIntRecord(tag, value int) (sql.Result, error) // AddFloatRecord makes a single float entry into the database for a given tag AddFloatRecord(tag int, value float64) (sql.Result, error) // Tally runs sql command to count database entries for a given topic Tally(tag int) int // GetLastRecord gets the last record for a given tag GetLastRecord(tag int) int // GetSingleInt returns the first result of any SQL query that gives at least one integer result // simple function for confirming correct value was entered for, say, temperature GetSingleInt(query string) int }
DBWrapper abstracts the underlying SQL engine/implementations
type Sqlite ¶
type Sqlite struct { File *os.File // name of the .db file FullPath string // full POSIX path Driver string // sqlite driver }
Sqlite handles connections to sqlite database
func (*Sqlite) Connect ¶
func (db *Sqlite) Connect() (*Connection, error)
Connect attaches to the sqlite database