Documentation ¶
Index ¶
- Variables
- type App
- func (a App) AddRelatedThing(ctx context.Context, thingId string, data []byte) error
- func (a App) CreateOrUpdateThing(ctx context.Context, data []byte) error
- func (a App) CreateThing(ctx context.Context, data []byte) error
- func (a App) IsValidThing(data []byte) (bool, error)
- func (a App) PatchThing(ctx context.Context, thingId string, patch []byte) error
- func (a App) QueryThings(ctx context.Context, conditions map[string][]string) (QueryResult, error)
- func (a App) RetrieveRelatedThings(ctx context.Context, thingId string) ([]byte, error)
- func (a App) RetrieveThing(ctx context.Context, thingId string) ([]byte, error)
- func (a App) Seed(ctx context.Context, data io.Reader) error
- func (a App) UpdateThing(ctx context.Context, data []byte) error
- type Location
- type QueryResult
- type Thing
- type ThingReader
- type ThingReaderMock
- func (mock *ThingReaderMock) QueryThings(ctx context.Context, conditions ...storage.ConditionFunc) (storage.QueryResult, error)
- func (mock *ThingReaderMock) QueryThingsCalls() []struct{ ... }
- func (mock *ThingReaderMock) RetrieveRelatedThings(ctx context.Context, thingId string) ([]byte, error)
- func (mock *ThingReaderMock) RetrieveRelatedThingsCalls() []struct{ ... }
- func (mock *ThingReaderMock) RetrieveThing(ctx context.Context, thingId string) ([]byte, string, error)
- func (mock *ThingReaderMock) RetrieveThingCalls() []struct{ ... }
- type ThingWriter
- type ThingWriterMock
- func (mock *ThingWriterMock) AddRelatedThing(ctx context.Context, thingId string, v []byte) error
- func (mock *ThingWriterMock) AddRelatedThingCalls() []struct{ ... }
- func (mock *ThingWriterMock) CreateThing(ctx context.Context, v []byte) error
- func (mock *ThingWriterMock) CreateThingCalls() []struct{ ... }
- func (mock *ThingWriterMock) UpdateThing(ctx context.Context, v []byte) error
- func (mock *ThingWriterMock) UpdateThingCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyExists error = fmt.Errorf("Thing already exists")
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func New ¶
func New(r ThingReader, w ThingWriter) App
func (App) AddRelatedThing ¶
func (App) CreateOrUpdateThing ¶
func (App) PatchThing ¶
func (App) QueryThings ¶
func (App) RetrieveRelatedThings ¶
func (App) RetrieveThing ¶
type QueryResult ¶
type ThingReader ¶
type ThingReaderMock ¶
type ThingReaderMock struct { // QueryThingsFunc mocks the QueryThings method. QueryThingsFunc func(ctx context.Context, conditions ...storage.ConditionFunc) (storage.QueryResult, error) // RetrieveRelatedThingsFunc mocks the RetrieveRelatedThings method. RetrieveRelatedThingsFunc func(ctx context.Context, thingId string) ([]byte, error) // RetrieveThingFunc mocks the RetrieveThing method. RetrieveThingFunc func(ctx context.Context, thingId string) ([]byte, string, error) // contains filtered or unexported fields }
ThingReaderMock is a mock implementation of ThingReader.
func TestSomethingThatUsesThingReader(t *testing.T) { // make and configure a mocked ThingReader mockedThingReader := &ThingReaderMock{ QueryThingsFunc: func(ctx context.Context, conditions ...storage.ConditionFunc) (storage.QueryResult, error) { panic("mock out the QueryThings method") }, RetrieveRelatedThingsFunc: func(ctx context.Context, thingId string) ([]byte, error) { panic("mock out the RetrieveRelatedThings method") }, RetrieveThingFunc: func(ctx context.Context, thingId string) ([]byte, string, error) { panic("mock out the RetrieveThing method") }, } // use mockedThingReader in code that requires ThingReader // and then make assertions. }
func (*ThingReaderMock) QueryThings ¶
func (mock *ThingReaderMock) QueryThings(ctx context.Context, conditions ...storage.ConditionFunc) (storage.QueryResult, error)
QueryThings calls QueryThingsFunc.
func (*ThingReaderMock) QueryThingsCalls ¶
func (mock *ThingReaderMock) QueryThingsCalls() []struct { Ctx context.Context Conditions []storage.ConditionFunc }
QueryThingsCalls gets all the calls that were made to QueryThings. Check the length with:
len(mockedThingReader.QueryThingsCalls())
func (*ThingReaderMock) RetrieveRelatedThings ¶
func (mock *ThingReaderMock) RetrieveRelatedThings(ctx context.Context, thingId string) ([]byte, error)
RetrieveRelatedThings calls RetrieveRelatedThingsFunc.
func (*ThingReaderMock) RetrieveRelatedThingsCalls ¶
func (mock *ThingReaderMock) RetrieveRelatedThingsCalls() []struct { Ctx context.Context ThingId string }
RetrieveRelatedThingsCalls gets all the calls that were made to RetrieveRelatedThings. Check the length with:
len(mockedThingReader.RetrieveRelatedThingsCalls())
func (*ThingReaderMock) RetrieveThing ¶
func (mock *ThingReaderMock) RetrieveThing(ctx context.Context, thingId string) ([]byte, string, error)
RetrieveThing calls RetrieveThingFunc.
func (*ThingReaderMock) RetrieveThingCalls ¶
func (mock *ThingReaderMock) RetrieveThingCalls() []struct { Ctx context.Context ThingId string }
RetrieveThingCalls gets all the calls that were made to RetrieveThing. Check the length with:
len(mockedThingReader.RetrieveThingCalls())
type ThingWriter ¶
type ThingWriterMock ¶
type ThingWriterMock struct { // AddRelatedThingFunc mocks the AddRelatedThing method. AddRelatedThingFunc func(ctx context.Context, thingId string, v []byte) error // CreateThingFunc mocks the CreateThing method. CreateThingFunc func(ctx context.Context, v []byte) error // UpdateThingFunc mocks the UpdateThing method. UpdateThingFunc func(ctx context.Context, v []byte) error // contains filtered or unexported fields }
ThingWriterMock is a mock implementation of ThingWriter.
func TestSomethingThatUsesThingWriter(t *testing.T) { // make and configure a mocked ThingWriter mockedThingWriter := &ThingWriterMock{ AddRelatedThingFunc: func(ctx context.Context, thingId string, v []byte) error { panic("mock out the AddRelatedThing method") }, CreateThingFunc: func(ctx context.Context, v []byte) error { panic("mock out the CreateThing method") }, UpdateThingFunc: func(ctx context.Context, v []byte) error { panic("mock out the UpdateThing method") }, } // use mockedThingWriter in code that requires ThingWriter // and then make assertions. }
func (*ThingWriterMock) AddRelatedThing ¶
AddRelatedThing calls AddRelatedThingFunc.
func (*ThingWriterMock) AddRelatedThingCalls ¶
func (mock *ThingWriterMock) AddRelatedThingCalls() []struct { Ctx context.Context ThingId string V []byte }
AddRelatedThingCalls gets all the calls that were made to AddRelatedThing. Check the length with:
len(mockedThingWriter.AddRelatedThingCalls())
func (*ThingWriterMock) CreateThing ¶
func (mock *ThingWriterMock) CreateThing(ctx context.Context, v []byte) error
CreateThing calls CreateThingFunc.
func (*ThingWriterMock) CreateThingCalls ¶
func (mock *ThingWriterMock) CreateThingCalls() []struct { Ctx context.Context V []byte }
CreateThingCalls gets all the calls that were made to CreateThing. Check the length with:
len(mockedThingWriter.CreateThingCalls())
func (*ThingWriterMock) UpdateThing ¶
func (mock *ThingWriterMock) UpdateThing(ctx context.Context, v []byte) error
UpdateThing calls UpdateThingFunc.
func (*ThingWriterMock) UpdateThingCalls ¶
func (mock *ThingWriterMock) UpdateThingCalls() []struct { Ctx context.Context V []byte }
UpdateThingCalls gets all the calls that were made to UpdateThing. Check the length with:
len(mockedThingWriter.UpdateThingCalls())