v0.0.0-...-1b63e00 Latest Latest

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

Go to latest
Published: Dec 30, 2022 License: Apache-2.0 Imports: 2 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


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) AddWeight

func (d *DataSource) AddWeight(weight float64) error

AddWeight Mock

func (*DataSource) CurrentWeight

func (d *DataSource) CurrentWeight() (*model.Weight, error)

CurrentWeight Mock

func (*DataSource) Export

func (d *DataSource) Export() (*model.ImpEx, error)

Export 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) Import

func (d *DataSource) Import(data *model.ImpEx) error

Import 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

func (*DataSource) SetConfig

func (d *DataSource) SetConfig(*model.Config) error

SetConfig Mock

func (*DataSource) Setup

func (d *DataSource) Setup(connection string) (func() error, error)

Setup 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

type Renderer struct {
	Expected string
	Err      error

Renderer is a mocked out renderer

func (*Renderer) AddEntry

func (r *Renderer) AddEntry(date string, calories int, food string) (string, error)

AddEntry Mock

func (*Renderer) AddWeight

func (r *Renderer) AddWeight(weight float64, config *model.Config) (string, error)

AddWeight Mock

func (*Renderer) ClearEntries

func (r *Renderer) ClearEntries(date string) (string, error)

ClearEntries Mock

func (*Renderer) ClearEntry

func (r *Renderer) ClearEntry(date string, entry *model.Entry) (string, error)

ClearEntry Mock

func (*Renderer) Config

func (r *Renderer) Config(config *model.Config, weight *model.Weight, amr, bmr float64, age int) (string, error)

Config Mock

func (*Renderer) Days

func (r *Renderer) Days(days model.Days, from, to time.Time) (string, error)

Days Mock

func (*Renderer) Error

func (r *Renderer) Error(err error) (string, error)

Error Mock

func (*Renderer) Import

func (r *Renderer) Import(fileName string, numEntries, numWeights int) (string, error)

Import Mock

func (*Renderer) WeightHistory

func (r *Renderer) WeightHistory(weights []model.Weight, config *model.Config) (string, error)

WeightHistory Mock

Jump to

Keyboard shortcuts

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