Documentation ¶
Overview ¶
Package stored provides interfacing methods for updating/retrieving data from the local sqlite3 database
Index ¶
- type DBEvaluation
- type Evaluation
- type LocalStore
- func (s *LocalStore) Add(model string, evaluation *evaluate.Evaluation) error
- func (s *LocalStore) Get(model string) ([]*Evaluation, error)
- func (s *LocalStore) GetModel(model string) (*Model, error)
- func (s *LocalStore) Remove(id int) error
- func (s *LocalStore) UpdateModel(model string, intervalsPassed int64) error
- type Model
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBEvaluation ¶
type DBEvaluation evaluate.Evaluation
DBEvaluation is an evaluation that can be stored in a SQL db, it is exactly the same as the evaluation but just with a Scan method implementation for marshalling from JSON
func (*DBEvaluation) Scan ¶
func (d *DBEvaluation) Scan(src interface{}) error
Scan is used when reading the DBEvaluation field in from the SQL db, marshalling from a JSON string
type Evaluation ¶
type Evaluation struct { ID int `db:"id"` Created time.Time `db:"created"` Evaluation DBEvaluation `db:"val"` }
Evaluation is an evaluation stored in the database, with an ID and a timestamp
type LocalStore ¶
LocalStore is the implementation of a Store for updating/retrieving evaluations from a SQL db
func (*LocalStore) Add ¶
func (s *LocalStore) Add(model string, evaluation *evaluate.Evaluation) error
Add inserts a new evaluation associated with a model
func (*LocalStore) Get ¶
func (s *LocalStore) Get(model string) ([]*Evaluation, error)
Get returns all evaluations associated with a model
func (*LocalStore) GetModel ¶
func (s *LocalStore) GetModel(model string) (*Model, error)
GetModel gets the model with the name provided
func (*LocalStore) Remove ¶
func (s *LocalStore) Remove(id int) error
Remove deletes an evaluation by the ID provided
func (*LocalStore) UpdateModel ¶
func (s *LocalStore) UpdateModel(model string, intervalsPassed int64) error
UpdateModel updates the model in the DB with the name provided, setting the intervals_passed value
type Model ¶
type Model struct { ID int `db:"id"` Name string `db:"model_name"` IntervalsPassed int64 `db:"intervals_passed"` }
Model is a model stored in the database, with an ID and the number of intervals since it was last used
type Store ¶
type Store interface { Get(model string) ([]*Evaluation, error) Add(model string, evaluation *evaluate.Evaluation) error Remove(id int) error GetModel(model string) (*Model, error) UpdateModel(model string, intervalsPassed int64) error }
Store allows updating/retrieving evaluations from a data source