Documentation
¶
Index ¶
- type DeviceReader
- type DeviceReaderWriter
- type DeviceReaderWriterMock
- func (mock *DeviceReaderWriterMock) CreateDevice(ctx context.Context, device entity.Device) error
- func (mock *DeviceReaderWriterMock) CreateDeviceCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) CreateNamespace(ctx context.Context, namespace entity.Namespace) error
- func (mock *DeviceReaderWriterMock) CreateNamespaceCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) CreateSet(ctx context.Context, set entity.Set) error
- func (mock *DeviceReaderWriterMock) CreateSetCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) DeleteNamespace(ctx context.Context, id string) error
- func (mock *DeviceReaderWriterMock) DeleteNamespaceCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) DeleteSet(ctx context.Context, id string) error
- func (mock *DeviceReaderWriterMock) DeleteSetCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) GetDefaultNamespace(ctx context.Context) (entity.Namespace, error)
- func (mock *DeviceReaderWriterMock) GetDefaultNamespaceCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) GetDevice(ctx context.Context, id string) (entity.Device, error)
- func (mock *DeviceReaderWriterMock) GetDeviceCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) GetDevices(ctx context.Context) ([]entity.Device, error)
- func (mock *DeviceReaderWriterMock) GetDevicesCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) GetNamespace(ctx context.Context, id string) (entity.Namespace, error)
- func (mock *DeviceReaderWriterMock) GetNamespaceCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) GetNamespaces(ctx context.Context) ([]entity.Namespace, error)
- func (mock *DeviceReaderWriterMock) GetNamespacesCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) GetSet(ctx context.Context, id string) (entity.Set, error)
- func (mock *DeviceReaderWriterMock) GetSetCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) GetSets(ctx context.Context) ([]entity.Set, error)
- func (mock *DeviceReaderWriterMock) GetSetsCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) UpdateDevice(ctx context.Context, device entity.Device) error
- func (mock *DeviceReaderWriterMock) UpdateDeviceCalls() []struct{ ... }
- func (mock *DeviceReaderWriterMock) UpdateNamespace(ctx context.Context, namespace entity.Namespace) error
- func (mock *DeviceReaderWriterMock) UpdateNamespaceCalls() []struct{ ... }
- type DeviceWriter
- type Service
- func (w *Service) CreateNamespace(ctx context.Context, namespace entity.Namespace) error
- func (w *Service) CreateSet(ctx context.Context, set entity.Set) error
- func (w *Service) DeleteNamespace(ctx context.Context, id string) (entity.Namespace, error)
- func (w *Service) DeleteSet(ctx context.Context, id string) (entity.Set, error)
- func (w *Service) GetDefaultNamespace(ctx context.Context) (entity.Namespace, error)
- func (w *Service) GetDevice(ctx context.Context, id string) (entity.Device, error)
- func (w *Service) GetDevices(ctx context.Context) ([]entity.Device, error)
- func (w *Service) GetNamespace(ctx context.Context, id string) (entity.Namespace, error)
- func (w *Service) GetNamespaces(ctx context.Context) ([]entity.Namespace, error)
- func (w *Service) GetSet(ctx context.Context, id string) (entity.Set, error)
- func (w *Service) GetSets(ctx context.Context) ([]entity.Set, error)
- func (w *Service) UpdateDevice(ctx context.Context, device entity.Device) error
- func (w *Service) UpdateNamespace(ctx context.Context, namespace entity.Namespace) (entity.Namespace, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceReader ¶
type DeviceReader interface { GetDevice(ctx context.Context, id string) (entity.Device, error) GetDevices(ctx context.Context) ([]entity.Device, error) GetNamespace(ctx context.Context, id string) (entity.Namespace, error) GetDefaultNamespace(ctx context.Context) (entity.Namespace, error) GetNamespaces(ctx context.Context) ([]entity.Namespace, error) GetSet(ctx context.Context, id string) (entity.Set, error) GetSets(ctx context.Context) ([]entity.Set, error) }
DeviceReader is an interface that groups all the methods allowing to query/get devices.
type DeviceReaderWriter ¶
type DeviceReaderWriter interface { DeviceReader DeviceWriter }
type DeviceReaderWriterMock ¶
type DeviceReaderWriterMock struct { // CreateDeviceFunc mocks the CreateDevice method. CreateDeviceFunc func(ctx context.Context, device entity.Device) error // CreateNamespaceFunc mocks the CreateNamespace method. CreateNamespaceFunc func(ctx context.Context, namespace entity.Namespace) error // CreateSetFunc mocks the CreateSet method. CreateSetFunc func(ctx context.Context, set entity.Set) error // DeleteNamespaceFunc mocks the DeleteNamespace method. DeleteNamespaceFunc func(ctx context.Context, id string) error // DeleteSetFunc mocks the DeleteSet method. DeleteSetFunc func(ctx context.Context, id string) error // GetDefaultNamespaceFunc mocks the GetDefaultNamespace method. GetDefaultNamespaceFunc func(ctx context.Context) (entity.Namespace, error) // GetDeviceFunc mocks the GetDevice method. GetDeviceFunc func(ctx context.Context, id string) (entity.Device, error) // GetDevicesFunc mocks the GetDevices method. GetDevicesFunc func(ctx context.Context) ([]entity.Device, error) // GetNamespaceFunc mocks the GetNamespace method. GetNamespaceFunc func(ctx context.Context, id string) (entity.Namespace, error) // GetNamespacesFunc mocks the GetNamespaces method. GetNamespacesFunc func(ctx context.Context) ([]entity.Namespace, error) // GetSetFunc mocks the GetSet method. GetSetFunc func(ctx context.Context, id string) (entity.Set, error) // GetSetsFunc mocks the GetSets method. GetSetsFunc func(ctx context.Context) ([]entity.Set, error) // UpdateDeviceFunc mocks the UpdateDevice method. UpdateDeviceFunc func(ctx context.Context, device entity.Device) error // UpdateNamespaceFunc mocks the UpdateNamespace method. UpdateNamespaceFunc func(ctx context.Context, namespace entity.Namespace) error // contains filtered or unexported fields }
DeviceReaderWriterMock is a mock implementation of DeviceReaderWriter.
func TestSomethingThatUsesDeviceReaderWriter(t *testing.T) { // make and configure a mocked DeviceReaderWriter mockedDeviceReaderWriter := &DeviceReaderWriterMock{ CreateDeviceFunc: func(ctx context.Context, device entity.Device) error { panic("mock out the CreateDevice method") }, CreateNamespaceFunc: func(ctx context.Context, namespace entity.Namespace) error { panic("mock out the CreateNamespace method") }, CreateSetFunc: func(ctx context.Context, set entity.Set) error { panic("mock out the CreateSet method") }, DeleteNamespaceFunc: func(ctx context.Context, id string) error { panic("mock out the DeleteNamespace method") }, DeleteSetFunc: func(ctx context.Context, id string) error { panic("mock out the DeleteSet method") }, GetDefaultNamespaceFunc: func(ctx context.Context) (entity.Namespace, error) { panic("mock out the GetDefaultNamespace method") }, GetDeviceFunc: func(ctx context.Context, id string) (entity.Device, error) { panic("mock out the GetDevice method") }, GetDevicesFunc: func(ctx context.Context) ([]entity.Device, error) { panic("mock out the GetDevices method") }, GetNamespaceFunc: func(ctx context.Context, id string) (entity.Namespace, error) { panic("mock out the GetNamespace method") }, GetNamespacesFunc: func(ctx context.Context) ([]entity.Namespace, error) { panic("mock out the GetNamespaces method") }, GetSetFunc: func(ctx context.Context, id string) (entity.Set, error) { panic("mock out the GetSet method") }, GetSetsFunc: func(ctx context.Context) ([]entity.Set, error) { panic("mock out the GetSets method") }, UpdateDeviceFunc: func(ctx context.Context, device entity.Device) error { panic("mock out the UpdateDevice method") }, UpdateNamespaceFunc: func(ctx context.Context, namespace entity.Namespace) error { panic("mock out the UpdateNamespace method") }, } // use mockedDeviceReaderWriter in code that requires DeviceReaderWriter // and then make assertions. }
func (*DeviceReaderWriterMock) CreateDevice ¶
CreateDevice calls CreateDeviceFunc.
func (*DeviceReaderWriterMock) CreateDeviceCalls ¶
func (mock *DeviceReaderWriterMock) CreateDeviceCalls() []struct { Ctx context.Context Device entity.Device }
CreateDeviceCalls gets all the calls that were made to CreateDevice. Check the length with:
len(mockedDeviceReaderWriter.CreateDeviceCalls())
func (*DeviceReaderWriterMock) CreateNamespace ¶
func (mock *DeviceReaderWriterMock) CreateNamespace(ctx context.Context, namespace entity.Namespace) error
CreateNamespace calls CreateNamespaceFunc.
func (*DeviceReaderWriterMock) CreateNamespaceCalls ¶
func (mock *DeviceReaderWriterMock) CreateNamespaceCalls() []struct { Ctx context.Context Namespace entity.Namespace }
CreateNamespaceCalls gets all the calls that were made to CreateNamespace. Check the length with:
len(mockedDeviceReaderWriter.CreateNamespaceCalls())
func (*DeviceReaderWriterMock) CreateSetCalls ¶
func (mock *DeviceReaderWriterMock) CreateSetCalls() []struct { Ctx context.Context Set entity.Set }
CreateSetCalls gets all the calls that were made to CreateSet. Check the length with:
len(mockedDeviceReaderWriter.CreateSetCalls())
func (*DeviceReaderWriterMock) DeleteNamespace ¶
func (mock *DeviceReaderWriterMock) DeleteNamespace(ctx context.Context, id string) error
DeleteNamespace calls DeleteNamespaceFunc.
func (*DeviceReaderWriterMock) DeleteNamespaceCalls ¶
func (mock *DeviceReaderWriterMock) DeleteNamespaceCalls() []struct { Ctx context.Context ID string }
DeleteNamespaceCalls gets all the calls that were made to DeleteNamespace. Check the length with:
len(mockedDeviceReaderWriter.DeleteNamespaceCalls())
func (*DeviceReaderWriterMock) DeleteSet ¶
func (mock *DeviceReaderWriterMock) DeleteSet(ctx context.Context, id string) error
DeleteSet calls DeleteSetFunc.
func (*DeviceReaderWriterMock) DeleteSetCalls ¶
func (mock *DeviceReaderWriterMock) DeleteSetCalls() []struct { Ctx context.Context ID string }
DeleteSetCalls gets all the calls that were made to DeleteSet. Check the length with:
len(mockedDeviceReaderWriter.DeleteSetCalls())
func (*DeviceReaderWriterMock) GetDefaultNamespace ¶
func (mock *DeviceReaderWriterMock) GetDefaultNamespace(ctx context.Context) (entity.Namespace, error)
GetDefaultNamespace calls GetDefaultNamespaceFunc.
func (*DeviceReaderWriterMock) GetDefaultNamespaceCalls ¶
func (mock *DeviceReaderWriterMock) GetDefaultNamespaceCalls() []struct { Ctx context.Context }
GetDefaultNamespaceCalls gets all the calls that were made to GetDefaultNamespace. Check the length with:
len(mockedDeviceReaderWriter.GetDefaultNamespaceCalls())
func (*DeviceReaderWriterMock) GetDevice ¶
func (mock *DeviceReaderWriterMock) GetDevice(ctx context.Context, id string) (entity.Device, error)
GetDevice calls GetDeviceFunc.
func (*DeviceReaderWriterMock) GetDeviceCalls ¶
func (mock *DeviceReaderWriterMock) GetDeviceCalls() []struct { Ctx context.Context ID string }
GetDeviceCalls gets all the calls that were made to GetDevice. Check the length with:
len(mockedDeviceReaderWriter.GetDeviceCalls())
func (*DeviceReaderWriterMock) GetDevices ¶
GetDevices calls GetDevicesFunc.
func (*DeviceReaderWriterMock) GetDevicesCalls ¶
func (mock *DeviceReaderWriterMock) GetDevicesCalls() []struct { Ctx context.Context }
GetDevicesCalls gets all the calls that were made to GetDevices. Check the length with:
len(mockedDeviceReaderWriter.GetDevicesCalls())
func (*DeviceReaderWriterMock) GetNamespace ¶
func (mock *DeviceReaderWriterMock) GetNamespace(ctx context.Context, id string) (entity.Namespace, error)
GetNamespace calls GetNamespaceFunc.
func (*DeviceReaderWriterMock) GetNamespaceCalls ¶
func (mock *DeviceReaderWriterMock) GetNamespaceCalls() []struct { Ctx context.Context ID string }
GetNamespaceCalls gets all the calls that were made to GetNamespace. Check the length with:
len(mockedDeviceReaderWriter.GetNamespaceCalls())
func (*DeviceReaderWriterMock) GetNamespaces ¶
GetNamespaces calls GetNamespacesFunc.
func (*DeviceReaderWriterMock) GetNamespacesCalls ¶
func (mock *DeviceReaderWriterMock) GetNamespacesCalls() []struct { Ctx context.Context }
GetNamespacesCalls gets all the calls that were made to GetNamespaces. Check the length with:
len(mockedDeviceReaderWriter.GetNamespacesCalls())
func (*DeviceReaderWriterMock) GetSetCalls ¶
func (mock *DeviceReaderWriterMock) GetSetCalls() []struct { Ctx context.Context ID string }
GetSetCalls gets all the calls that were made to GetSet. Check the length with:
len(mockedDeviceReaderWriter.GetSetCalls())
func (*DeviceReaderWriterMock) GetSetsCalls ¶
func (mock *DeviceReaderWriterMock) GetSetsCalls() []struct { Ctx context.Context }
GetSetsCalls gets all the calls that were made to GetSets. Check the length with:
len(mockedDeviceReaderWriter.GetSetsCalls())
func (*DeviceReaderWriterMock) UpdateDevice ¶
UpdateDevice calls UpdateDeviceFunc.
func (*DeviceReaderWriterMock) UpdateDeviceCalls ¶
func (mock *DeviceReaderWriterMock) UpdateDeviceCalls() []struct { Ctx context.Context Device entity.Device }
UpdateDeviceCalls gets all the calls that were made to UpdateDevice. Check the length with:
len(mockedDeviceReaderWriter.UpdateDeviceCalls())
func (*DeviceReaderWriterMock) UpdateNamespace ¶
func (mock *DeviceReaderWriterMock) UpdateNamespace(ctx context.Context, namespace entity.Namespace) error
UpdateNamespace calls UpdateNamespaceFunc.
func (*DeviceReaderWriterMock) UpdateNamespaceCalls ¶
func (mock *DeviceReaderWriterMock) UpdateNamespaceCalls() []struct { Ctx context.Context Namespace entity.Namespace }
UpdateNamespaceCalls gets all the calls that were made to UpdateNamespace. Check the length with:
len(mockedDeviceReaderWriter.UpdateNamespaceCalls())
type DeviceWriter ¶
type DeviceWriter interface { CreateDevice(ctx context.Context, device entity.Device) error UpdateDevice(ctx context.Context, device entity.Device) error CreateSet(ctx context.Context, set entity.Set) error DeleteSet(ctx context.Context, id string) error DeleteNamespace(ctx context.Context, id string) error CreateNamespace(ctx context.Context, namespace entity.Namespace) error UpdateNamespace(ctx context.Context, namespace entity.Namespace) error }
DeviceWriter allows creating a device.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(pgDeviceRepo DeviceReaderWriter) *Service
func (*Service) CreateNamespace ¶
func (*Service) DeleteNamespace ¶
DeleteNamespace removes a namespace. The last namespace cannot be removed