Documentation ¶
Index ¶
- type DataSource
- func (d *DataSource) AddEntry(entryDate string, calories int, food string) error
- func (d *DataSource) AddWeight(weight float64) error
- func (d *DataSource) CurrentWeight() (*model.Weight, error)
- func (d *DataSource) Export() (*model.ImpEx, error)
- func (d *DataSource) FetchAllEntries() (model.Entries, error)
- func (d *DataSource) FetchConfig() (*model.Config, error)
- func (d *DataSource) FetchEntries(entryDate string) (model.Entries, error)
- func (d *DataSource) FetchWeights() ([]model.Weight, error)
- func (d *DataSource) Import(data *model.ImpEx) error
- func (d *DataSource) RemoveEntries(entryDate string) error
- func (d *DataSource) RemoveEntry(entryDate string, id int) error
- func (d *DataSource) SetConfig(*model.Config) error
- func (d *DataSource) Setup(connection string) (func() error, error)
- type Expectation
- type Expectations
- type Renderer
- func (r *Renderer) AddEntry(date string, calories int, food string) (string, error)
- func (r *Renderer) AddWeight(weight float64, config *model.Config) (string, error)
- func (r *Renderer) ClearEntries(date string) (string, error)
- func (r *Renderer) ClearEntry(date string, entry *model.Entry) (string, error)
- func (r *Renderer) Config(config *model.Config, weight *model.Weight, amr, bmr float64, age int) (string, error)
- func (r *Renderer) Days(days model.Days, from, to time.Time) (string, error)
- func (r *Renderer) Error(err error) (string, error)
- func (r *Renderer) Import(fileName string, numEntries, numWeights int) (string, error)
- func (r *Renderer) WeightHistory(weights []model.Weight, config *model.Config) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataSource ¶
type DataSource struct {
Expectations Expectations
}
DataSource is a mocked out datasource
func (*DataSource) AddEntry ¶
func (d *DataSource) AddEntry(entryDate string, calories int, food string) error
AddEntry Mock
func (*DataSource) CurrentWeight ¶
func (d *DataSource) CurrentWeight() (*model.Weight, error)
CurrentWeight Mock
func (*DataSource) FetchAllEntries ¶
func (d *DataSource) FetchAllEntries() (model.Entries, error)
FetchAllEntries Mock
func (*DataSource) FetchConfig ¶
func (d *DataSource) FetchConfig() (*model.Config, error)
FetchConfig Mock
func (*DataSource) FetchEntries ¶
func (d *DataSource) FetchEntries(entryDate string) (model.Entries, error)
FetchEntries Mock
func (*DataSource) FetchWeights ¶
func (d *DataSource) FetchWeights() ([]model.Weight, error)
FetchWeights Mock
func (*DataSource) RemoveEntries ¶
func (d *DataSource) RemoveEntries(entryDate string) error
RemoveEntries Mock
func (*DataSource) RemoveEntry ¶
func (d *DataSource) RemoveEntry(entryDate string, id int) error
RemoveEntry Mock
type Expectation ¶
type Expectation struct { CallCount int DefaultReturn interface{} ReturnValues []interface{} }
Expectation depicts expectations for multiple calls of a function
func (*Expectation) Return ¶
func (e *Expectation) Return() (interface{}, error)
Return returns a return value and increases the callcount
type Expectations ¶
type Expectations map[string]*Expectation
Expectations are a mapping from function name to Expectations
func (Expectations) Add ¶
func (e Expectations) Add(fn string, def interface{}, retValues ...interface{})
Add adds an expectation
func (Expectations) Return ¶
func (e Expectations) Return(fn string) (interface{}, error)
Return returns an expecatation's Return function result
type Renderer ¶
Renderer is a mocked out renderer
func (*Renderer) ClearEntries ¶
ClearEntries Mock
func (*Renderer) ClearEntry ¶
ClearEntry Mock
func (*Renderer) Config ¶
func (r *Renderer) Config(config *model.Config, weight *model.Weight, amr, bmr float64, age int) (string, error)
Config Mock
Click to show internal directories.
Click to hide internal directories.