Versions in this module Expand all Collapse all v0 v0.0.1 Dec 5, 2018 Changes in this version + const OxiRecordSchema + const SessionSchema + var ErrNotFound = errors.New("Record not found in database") + type DB struct + func (db *DB) FetchAllSessions() ([]*Session, error) + func (db *DB) FetchLatestSession() (*Session, error) + func (db *DB) FetchPreviousSession() (*Session, error) + func (db *DB) FetchRecords(from, to time.Time) ([]*OxiRecord, error) + func (db *DB) FetchRecordsBySessionID(sessionID int64) ([]*OxiRecord, error) + func (db *DB) FetchSessionByStartTime(start time.Time) (*Session, error) + func (db *DB) Initialize() error + func (db *DB) SaveRecords(records []*OxiRecord) error + func (db *DB) SaveSession(session *Session) error + type Datastore interface + FetchAllSessions func() ([]*Session, error) + FetchLatestSession func() (*Session, error) + FetchPreviousSession func() (*Session, error) + FetchRecords func(from, to time.Time) ([]*OxiRecord, error) + FetchRecordsBySessionID func(id int64) ([]*OxiRecord, error) + FetchSessionByStartTime func(start time.Time) (*Session, error) + Initialize func() error + SaveRecords func(records []*OxiRecord) error + SaveSession func(session *Session) error + func NewDB(driver, dsn string) (Datastore, error) + type OxiRecord struct + DateTime time.Time + Pulse uint8 + SessionID int64 + Spo2 uint8 + func (r *OxiRecord) String() string + type Session struct + ID int64 + Model string + Seconds int + StartTime time.Time + func (s *Session) String() string