Documentation ¶
Index ¶
- type Config
- type LogValue
- type Storage
- type StorageMock
- func (mock *StorageMock) Add(ctx context.Context, id string, label string, value float64, ...) error
- func (mock *StorageMock) AddCalls() []struct{ ... }
- func (mock *StorageMock) AddFnCalls() []struct{ ... }
- func (mock *StorageMock) AddFnct(ctx context.Context, id string, fnType string, subType string, tenant string, ...) error
- func (mock *StorageMock) History(ctx context.Context, id string, label string, lastN int) ([]LogValue, error)
- func (mock *StorageMock) HistoryCalls() []struct{ ... }
- func (mock *StorageMock) Initialize(contextMoqParam context.Context) error
- func (mock *StorageMock) InitializeCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func LoadConfiguration ¶
type Storage ¶
type Storage interface { Initialize(context.Context) error Add(ctx context.Context, id, label string, value float64, timestamp time.Time) error AddFnct(ctx context.Context, id, fnType, subType, tenant, source string, lat, lon float64) error History(ctx context.Context, id, label string, lastN int) ([]LogValue, error) }
type StorageMock ¶
type StorageMock struct { // AddFunc mocks the Add method. AddFunc func(ctx context.Context, id string, label string, value float64, timestamp time.Time) error // AddFnFunc mocks the AddFn method. AddFnFunc func(ctx context.Context, id string, fnType string, subType string, tenant string, source string, lat float64, lon float64) error // HistoryFunc mocks the History method. HistoryFunc func(ctx context.Context, id string, label string, lastN int) ([]LogValue, error) // InitializeFunc mocks the Initialize method. InitializeFunc func(contextMoqParam context.Context) error // contains filtered or unexported fields }
StorageMock is a mock implementation of Storage.
func TestSomethingThatUsesStorage(t *testing.T) { // make and configure a mocked Storage mockedStorage := &StorageMock{ AddFunc: func(ctx context.Context, id string, label string, value float64, timestamp time.Time) error { panic("mock out the Add method") }, AddFnFunc: func(ctx context.Context, id string, fnType string, subType string, tenant string, source string, lat float64, lon float64) error { panic("mock out the AddFn method") }, HistoryFunc: func(ctx context.Context, id string, label string, lastN int) ([]LogValue, error) { panic("mock out the History method") }, InitializeFunc: func(contextMoqParam context.Context) error { panic("mock out the Initialize method") }, } // use mockedStorage in code that requires Storage // and then make assertions. }
func (*StorageMock) Add ¶
func (mock *StorageMock) Add(ctx context.Context, id string, label string, value float64, timestamp time.Time) error
Add calls AddFunc.
func (*StorageMock) AddCalls ¶
func (mock *StorageMock) AddCalls() []struct { Ctx context.Context ID string Label string Value float64 Timestamp time.Time }
AddCalls gets all the calls that were made to Add. Check the length with:
len(mockedStorage.AddCalls())
func (*StorageMock) AddFnCalls ¶
func (mock *StorageMock) AddFnCalls() []struct { Ctx context.Context ID string FnType string SubType string Tenant string Source string Lat float64 Lon float64 }
AddFnCalls gets all the calls that were made to AddFn. Check the length with:
len(mockedStorage.AddFnCalls())
func (*StorageMock) AddFnct ¶
func (mock *StorageMock) AddFnct(ctx context.Context, id string, fnType string, subType string, tenant string, source string, lat float64, lon float64) error
AddFnct calls AddFnFunc.
func (*StorageMock) History ¶
func (mock *StorageMock) History(ctx context.Context, id string, label string, lastN int) ([]LogValue, error)
History calls HistoryFunc.
func (*StorageMock) HistoryCalls ¶
func (mock *StorageMock) HistoryCalls() []struct { Ctx context.Context ID string Label string LastN int }
HistoryCalls gets all the calls that were made to History. Check the length with:
len(mockedStorage.HistoryCalls())
func (*StorageMock) Initialize ¶
func (mock *StorageMock) Initialize(contextMoqParam context.Context) error
Initialize calls InitializeFunc.
func (*StorageMock) InitializeCalls ¶
func (mock *StorageMock) InitializeCalls() []struct { ContextMoqParam context.Context }
InitializeCalls gets all the calls that were made to Initialize. Check the length with:
len(mockedStorage.InitializeCalls())
Click to show internal directories.
Click to hide internal directories.