metathings_deviced_storage

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidArgument = errors.New("invalid argument")
)

Functions

This section is empty.

Types

type Device

type Device struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	HeartbeatAt *time.Time
	Kind        *string `gorm:"column:kind"`
	State       *string `gorm:"column:state"`
	Name        *string `gorm:"column:name"`
	Alias       *string `gorm:"column:alias"`

	Modules []*Module `gorm:"-"`
	Flows   []*Flow   `gorm:"-"`
}

type Flow

type Flow struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	DeviceId *string `gorm:"column:device_id"`
	Name     *string `gorm:"column:name"`
	Alias    *string `gorm:"column:alias"`

	Device *Device `gorm:"-"`
}

type Module

type Module struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	HeartbeatAt *time.Time
	State       *string `gorm:"column:state"`
	DeviceId    *string `gorm:"column:device_id"`
	Endpoint    *string `gorm:"column:endpoint"`
	Component   *string `gorm:"column:component"`
	Name        *string `gorm:"column:name"`
	Alias       *string `gorm:"column:alias"`

	Device *Device `gorm:"-"`
}

type Storage

type Storage interface {
	CreateDevice(*Device) (*Device, error)
	DeleteDevice(id string) error
	PatchDevice(id string, device *Device) (*Device, error)
	GetDevice(id string) (*Device, error)
	ListDevices(*Device) ([]*Device, error)
	GetDeviceByModuleId(id string) (*Device, error)

	CreateModule(*Module) (*Module, error)
	DeleteModule(id string) error
	PatchModule(id string, module *Module) (*Module, error)
	GetModule(id string) (*Module, error)
	ListModules(*Module) ([]*Module, error)

	CreateFlow(*Flow) (*Flow, error)
	DeleteFlow(id string) error
	PatchFlow(id string, flow *Flow) (*Flow, error)
	GetFlow(id string) (*Flow, error)
	ListFlows(*Flow) ([]*Flow, error)
}

func NewStorage

func NewStorage(driver, uri string, args ...interface{}) (Storage, error)

type StorageImpl

type StorageImpl struct {
	// contains filtered or unexported fields
}

func NewStorageImpl

func NewStorageImpl(driver, uri string, args ...interface{}) (*StorageImpl, error)

func (*StorageImpl) CreateDevice

func (self *StorageImpl) CreateDevice(dev *Device) (*Device, error)

func (*StorageImpl) CreateFlow

func (self *StorageImpl) CreateFlow(flw *Flow) (*Flow, error)

func (*StorageImpl) CreateModule

func (self *StorageImpl) CreateModule(mdl *Module) (*Module, error)

func (*StorageImpl) DeleteDevice

func (self *StorageImpl) DeleteDevice(id string) error

func (*StorageImpl) DeleteFlow

func (self *StorageImpl) DeleteFlow(id string) error

func (*StorageImpl) DeleteModule

func (self *StorageImpl) DeleteModule(id string) error

func (*StorageImpl) GetDevice

func (self *StorageImpl) GetDevice(id string) (*Device, error)

func (*StorageImpl) GetDeviceByModuleId added in v0.100.0

func (self *StorageImpl) GetDeviceByModuleId(id string) (*Device, error)

func (*StorageImpl) GetFlow

func (self *StorageImpl) GetFlow(id string) (*Flow, error)

func (*StorageImpl) GetModule

func (self *StorageImpl) GetModule(id string) (*Module, error)

func (*StorageImpl) ListDevices

func (self *StorageImpl) ListDevices(dev *Device) ([]*Device, error)

func (*StorageImpl) ListFlows

func (self *StorageImpl) ListFlows(flw *Flow) ([]*Flow, error)

func (*StorageImpl) ListModules

func (self *StorageImpl) ListModules(mdl *Module) ([]*Module, error)

func (*StorageImpl) PatchDevice

func (self *StorageImpl) PatchDevice(id string, device *Device) (*Device, error)

func (*StorageImpl) PatchFlow

func (self *StorageImpl) PatchFlow(id string, flw *Flow) (*Flow, error)

func (*StorageImpl) PatchModule

func (self *StorageImpl) PatchModule(id string, mdl *Module) (*Module, error)

Jump to

Keyboard shortcuts

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