adaptors

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adaptors

type Adaptors struct {
	Node             *Node
	Script           *Script
	Workflow         *Workflow
	WorkflowScenario *WorkflowScenario
	Device           *Device
	DeviceAction     *DeviceAction
	DeviceState      *DeviceState
	Flow             *Flow
	FlowElement      *FlowElement
	Connection       *Connection
	Worker           *Worker
	Role             *Role
	Permission       *Permission
	User             *User
	UserMeta         *UserMeta
	Image            *Image
	Variable         *Variable
	Map              *Map
	MapLayer         *MapLayer
	MapText          *MapText
	MapImage         *MapImage
	MapDevice        *MapDevice
	MapElement       *MapElement
	MapDeviceState   *MapDeviceState
	MapDeviceAction  *MapDeviceAction
	Log              *Log
}

func NewAdaptors

func NewAdaptors(db *gorm.DB,
	cfg *config.AppConfig,
	migrations *migrations.Migrations) (adaptors *Adaptors)

type Connection

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

func GetConnectionAdaptor

func GetConnectionAdaptor(d *gorm.DB) *Connection

func (*Connection) Add

func (n *Connection) Add(con *m.Connection) (id uuid.UUID, err error)

func (*Connection) AddOrUpdateConnection

func (n *Connection) AddOrUpdateConnection(connection *m.Connection) (err error)

func (*Connection) Delete

func (n *Connection) Delete(conIds []uuid.UUID) (err error)

func (*Connection) GetById

func (n *Connection) GetById(conId uuid.UUID) (con *m.Connection, err error)

func (*Connection) List

func (n *Connection) List(limit, offset int64, orderBy, sort string) (list []*m.Connection, total int64, err error)

func (*Connection) Update

func (n *Connection) Update(con *m.Connection) (err error)

type Device

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

func GetDeviceAdaptor

func GetDeviceAdaptor(d *gorm.DB) *Device

func (*Device) Add

func (n *Device) Add(device *m.Device) (id int64, err error)

func (*Device) Delete

func (n *Device) Delete(deviceId int64) (err error)

func (*Device) GetAllEnabled

func (n *Device) GetAllEnabled() (list []*m.Device, err error)

func (*Device) GetById

func (n *Device) GetById(deviceId int64) (device *m.Device, err error)

func (*Device) List

func (n *Device) List(limit, offset int64, orderBy, sort string) (list []*m.Device, total int64, err error)

func (*Device) Search

func (n *Device) Search(query string, limit, offset int) (list []*m.Device, total int64, err error)

func (*Device) Update

func (n *Device) Update(device *m.Device) (err error)

type DeviceAction

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

func GetDeviceActionAdaptor

func GetDeviceActionAdaptor(d *gorm.DB) *DeviceAction

func (*DeviceAction) Add

func (n *DeviceAction) Add(device *m.DeviceAction) (id int64, err error)

func (*DeviceAction) Delete

func (n *DeviceAction) Delete(deviceId int64) (err error)

func (*DeviceAction) GetByDeviceId

func (n *DeviceAction) GetByDeviceId(deviceId int64) (actions []*m.DeviceAction, err error)

func (*DeviceAction) GetById

func (n *DeviceAction) GetById(actionId int64) (device *m.DeviceAction, err error)

func (*DeviceAction) List

func (n *DeviceAction) List(limit, offset int64, orderBy, sort string) (list []*m.DeviceAction, total int64, err error)

func (*DeviceAction) Search

func (n *DeviceAction) Search(query string, limit, offset int) (list []*m.DeviceAction, total int64, err error)

func (*DeviceAction) Update

func (n *DeviceAction) Update(device *m.DeviceAction) (err error)

type DeviceDefault

type DeviceDefault struct {
	Address *int `json:"address"`
}

type DeviceSmartBus

type DeviceSmartBus struct {
	Address  *int          `json:"address"`
	Baud     int           `json:"baud"`
	Sleep    int64         `json:"sleep"`
	StopBite int64         `json:"stop_bite"`
	Timeout  time.Duration `json:"timeout"`
	Tty      string        `json:"tty"`
}

type DeviceState

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

func GetDeviceStateAdaptor

func GetDeviceStateAdaptor(d *gorm.DB) *DeviceState

func (*DeviceState) Add

func (n *DeviceState) Add(device *m.DeviceState) (id int64, err error)

func (*DeviceState) Delete

func (n *DeviceState) Delete(deviceId int64) (err error)

func (*DeviceState) GetByDeviceId

func (n *DeviceState) GetByDeviceId(deviceId int64) (states []*m.DeviceState, err error)

func (*DeviceState) GetById

func (n *DeviceState) GetById(deviceId int64) (device *m.DeviceState, err error)

func (*DeviceState) List

func (n *DeviceState) List(limit, offset int64, orderBy, sort string) (list []*m.DeviceState, total int64, err error)

func (*DeviceState) Update

func (n *DeviceState) Update(device *m.DeviceState) (err error)

type DeviceZigBee

type DeviceZigBee struct {
	Address string `json:"address"`
}

type Flow

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

func GetFlowAdaptor

func GetFlowAdaptor(d *gorm.DB) *Flow

func (*Flow) Add

func (n *Flow) Add(flow *m.Flow) (id int64, err error)

func (*Flow) Delete

func (n *Flow) Delete(flowId int64) (err error)

func (*Flow) GetAllEnabled

func (n *Flow) GetAllEnabled() (list []*m.Flow, err error)

func (*Flow) GetAllEnabledByWorkflow

func (n *Flow) GetAllEnabledByWorkflow(workflowId int64) (list []*m.Flow, err error)

func (*Flow) GetById

func (n *Flow) GetById(flowId int64) (flow *m.Flow, err error)

func (*Flow) List

func (n *Flow) List(limit, offset int64, orderBy, sort string) (list []*m.Flow, total int64, err error)

func (*Flow) Search

func (n *Flow) Search(query string, limit, offset int) (list []*m.Flow, total int64, err error)

func (*Flow) Update

func (n *Flow) Update(flow *m.Flow) (err error)

type FlowElement

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

func GetFlowElementAdaptor

func GetFlowElementAdaptor(d *gorm.DB) *FlowElement

func (*FlowElement) Add

func (n *FlowElement) Add(element *m.FlowElement) (id uuid.UUID, err error)

func (*FlowElement) AddOrUpdateFlowElement

func (n *FlowElement) AddOrUpdateFlowElement(element *m.FlowElement) (err error)

func (*FlowElement) Delete

func (n *FlowElement) Delete(ids []uuid.UUID) (err error)

func (*FlowElement) GetAllEnabled

func (n *FlowElement) GetAllEnabled() (list []*m.FlowElement, err error)

func (*FlowElement) GetById

func (n *FlowElement) GetById(elementId uuid.UUID) (element *m.FlowElement, err error)

func (*FlowElement) List

func (n *FlowElement) List(limit, offset int64, orderBy, sort string) (list []*m.FlowElement, total int64, err error)

func (*FlowElement) Update

func (n *FlowElement) Update(element *m.FlowElement) (err error)

type Image

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

func GetImageAdaptor

func GetImageAdaptor(d *gorm.DB) *Image

func (*Image) Add

func (n *Image) Add(ver *m.Image) (id int64, err error)

func (*Image) AddMultiple

func (n *Image) AddMultiple(items []*m.Image) (err error)

func (*Image) Delete

func (n *Image) Delete(mapId int64) (err error)

func (*Image) GetAllByDate

func (n *Image) GetAllByDate(filter string) (images []*m.Image, err error)

func (*Image) GetById

func (n *Image) GetById(mapId int64) (ver *m.Image, err error)

func (*Image) GetFilterList

func (n *Image) GetFilterList() (filterList []*m.ImageFilterList, err error)

func (*Image) List

func (n *Image) List(limit, offset int64, orderBy, sort string) (list []*m.Image, total int64, err error)

func (*Image) Update

func (n *Image) Update(ver *m.Image) (err error)

func (*Image) UploadImage

func (n *Image) UploadImage(reader *bufio.Reader, fileName string) (err error)

type Log

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

func GetLogAdaptor

func GetLogAdaptor(d *gorm.DB) *Log

func (*Log) Add

func (n *Log) Add(ver *m.Log) (id int64, err error)

func (*Log) Delete

func (n *Log) Delete(verId int64) (err error)

func (*Log) GetById

func (n *Log) GetById(verId int64) (ver *m.Log, err error)

func (*Log) List

func (n *Log) List(limit, offset int64, orderBy, sort string, queryObj *m.LogQuery) (list []*m.Log, total int64, err error)

func (*Log) Search

func (n *Log) Search(query string, limit, offset int) (list []*m.Log, total int64, err error)

type Map

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

func GetMapAdaptor

func GetMapAdaptor(d *gorm.DB) *Map

func (*Map) Add

func (n *Map) Add(ver *m.Map) (id int64, err error)

func (*Map) Delete

func (n *Map) Delete(mapId int64) (err error)

func (*Map) GetById

func (n *Map) GetById(mapId int64) (ver *m.Map, err error)

func (*Map) GetFullById

func (n *Map) GetFullById(mapId int64) (ver *m.Map, err error)

func (*Map) List

func (n *Map) List(limit, offset int64, orderBy, sort string) (list []*m.Map, total int64, err error)

func (*Map) Search

func (n *Map) Search(query string, limit, offset int) (list []*m.Map, total int64, err error)

func (*Map) Update

func (n *Map) Update(ver *m.Map) (err error)

type MapDevice

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

func GetMapDeviceAdaptor

func GetMapDeviceAdaptor(d *gorm.DB) *MapDevice

func (*MapDevice) Add

func (n *MapDevice) Add(ver *m.MapDevice) (id int64, err error)

func (*MapDevice) Delete

func (n *MapDevice) Delete(mapId int64) (err error)

func (*MapDevice) GetById

func (n *MapDevice) GetById(mapId int64) (ver *m.MapDevice, err error)

type MapDeviceAction

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

func GetMapDeviceActionAdaptor

func GetMapDeviceActionAdaptor(d *gorm.DB) *MapDeviceAction

func (*MapDeviceAction) Add

func (n *MapDeviceAction) Add(ver *m.MapDeviceAction) (id int64, err error)

func (*MapDeviceAction) AddMultiple

func (n *MapDeviceAction) AddMultiple(items []*m.MapDeviceAction) (err error)

type MapDeviceState

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

func GetMapDeviceStateAdaptor

func GetMapDeviceStateAdaptor(d *gorm.DB) *MapDeviceState

func (*MapDeviceState) Add

func (n *MapDeviceState) Add(ver *m.MapDeviceState) (id int64, err error)

func (*MapDeviceState) AddMultiple

func (n *MapDeviceState) AddMultiple(items []*m.MapDeviceState) (err error)

type MapElement

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

func GetMapElementAdaptor

func GetMapElementAdaptor(d *gorm.DB) *MapElement

func (*MapElement) Add

func (n *MapElement) Add(ver *m.MapElement) (id int64, err error)

func (*MapElement) Delete

func (n *MapElement) Delete(mapId int64) (err error)

func (*MapElement) GetById

func (n *MapElement) GetById(mapId int64) (ver *m.MapElement, err error)

func (*MapElement) List

func (n *MapElement) List(limit, offset int64, orderBy, sort string) (list []*m.MapElement, total int64, err error)

func (*MapElement) Sort

func (n *MapElement) Sort(ver *m.MapElement) (err error)

func (*MapElement) Update

func (n *MapElement) Update(ver *m.MapElement) (err error)

type MapImage

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

func GetMapImageAdaptor

func GetMapImageAdaptor(d *gorm.DB) *MapImage

func (*MapImage) Add

func (n *MapImage) Add(ver *m.MapImage) (id int64, err error)

func (*MapImage) Delete

func (n *MapImage) Delete(mapId int64) (err error)

func (*MapImage) GetById

func (n *MapImage) GetById(mapId int64) (ver *m.MapImage, err error)

func (*MapImage) List

func (n *MapImage) List(limit, offset int64, orderBy, sort string) (list []*m.MapImage, total int64, err error)

func (*MapImage) Sort

func (n *MapImage) Sort(ver *m.MapImage) (err error)

func (*MapImage) Update

func (n *MapImage) Update(ver *m.MapImage) (err error)

type MapLayer

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

func GetMapLayerAdaptor

func GetMapLayerAdaptor(d *gorm.DB) *MapLayer

func (*MapLayer) Add

func (n *MapLayer) Add(ver *m.MapLayer) (id int64, err error)

func (*MapLayer) Delete

func (n *MapLayer) Delete(mapId int64) (err error)

func (*MapLayer) GetById

func (n *MapLayer) GetById(mapId int64) (ver *m.MapLayer, err error)

func (*MapLayer) List

func (n *MapLayer) List(limit, offset int64, orderBy, sort string) (list []*m.MapLayer, total int64, err error)

func (*MapLayer) Sort

func (n *MapLayer) Sort(ver *m.MapLayer) (err error)

func (*MapLayer) Update

func (n *MapLayer) Update(ver *m.MapLayer) (err error)

type MapText

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

func GetMapTextAdaptor

func GetMapTextAdaptor(d *gorm.DB) *MapText

func (*MapText) Add

func (n *MapText) Add(ver *m.MapText) (id int64, err error)

func (*MapText) Delete

func (n *MapText) Delete(mapId int64) (err error)

func (*MapText) GetById

func (n *MapText) GetById(mapId int64) (ver *m.MapText, err error)

func (*MapText) List

func (n *MapText) List(limit, offset int64, orderBy, sort string) (list []*m.MapText, total int64, err error)

func (*MapText) Sort

func (n *MapText) Sort(ver *m.MapText) (err error)

func (*MapText) Update

func (n *MapText) Update(ver *m.MapText) (err error)

type Node

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

func GetNodeAdaptor

func GetNodeAdaptor(d *gorm.DB) *Node

func (*Node) Add

func (n *Node) Add(node *m.Node) (id int64, err error)

func (*Node) Delete

func (n *Node) Delete(nodeId int64) (err error)

func (*Node) GetAllEnabled

func (n *Node) GetAllEnabled() (list []*m.Node, err error)

func (*Node) GetById

func (n *Node) GetById(nodeId int64) (node *m.Node, err error)

func (*Node) GetByLogin

func (a *Node) GetByLogin(login string) (ver *m.Node, err error)

func (*Node) List

func (n *Node) List(limit, offset int64, orderBy, sort string) (list []*m.Node, total int64, err error)

func (*Node) Search

func (n *Node) Search(query string, limit, offset int) (list []*m.Node, total int64, err error)

func (*Node) Update

func (n *Node) Update(node *m.Node) (err error)

type Permission

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

func GetPermissionAdaptor

func GetPermissionAdaptor(d *gorm.DB) *Permission

func (*Permission) Add

func (n *Permission) Add(permission *m.Permission) (id int64, err error)

func (*Permission) Delete

func (n *Permission) Delete(packageName string, levelName []string) (err error)

func (*Permission) GetAllPermissions

func (n *Permission) GetAllPermissions(roleName string) (permissions []*m.Permission, err error)

type Role

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

func GetRoleAdaptor

func GetRoleAdaptor(d *gorm.DB) *Role

func (*Role) Add

func (n *Role) Add(role *m.Role) (err error)

func (*Role) Delete

func (n *Role) Delete(name string) (err error)

func (*Role) GetAccessList

func (n *Role) GetAccessList(role *m.Role) (err error)

func (*Role) GetByName

func (n *Role) GetByName(name string) (role *m.Role, err error)

func (*Role) List

func (n *Role) List(limit, offset int64, orderBy, sort string) (list []*m.Role, total int64, err error)

func (*Role) Search

func (n *Role) Search(query string, limit, offset int) (list []*m.Role, total int64, err error)

func (*Role) Update

func (n *Role) Update(role *m.Role) (err error)

type Script

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

func GetScriptAdaptor

func GetScriptAdaptor(d *gorm.DB) *Script

func (*Script) Add

func (n *Script) Add(script *m.Script) (id int64, err error)

func (*Script) Delete

func (n *Script) Delete(scriptId int64) (err error)

func (*Script) GetById

func (n *Script) GetById(scriptId int64) (script *m.Script, err error)

func (*Script) List

func (n *Script) List(limit, offset int64, orderBy, sort string) (list []*m.Script, total int64, err error)

func (*Script) Search

func (n *Script) Search(query string, limit, offset int) (list []*m.Script, total int64, err error)

func (*Script) Update

func (n *Script) Update(script *m.Script) (err error)

type User

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

func GetUserAdaptor

func GetUserAdaptor(d *gorm.DB) *User

func (*User) Add

func (n *User) Add(user *m.User) (id int64, err error)

func (*User) ClearResetPassToken

func (n *User) ClearResetPassToken(u *m.User) (err error)

func (*User) ClearToken

func (n *User) ClearToken(u *m.User) (err error)

func (*User) Delete

func (n *User) Delete(userId int64) (err error)

func (*User) GenResetPassToken

func (n *User) GenResetPassToken(u *m.User) (token string, err error)

func (*User) GetByAuthenticationToken

func (n *User) GetByAuthenticationToken(token string) (user *m.User, err error)

func (*User) GetByEmail

func (n *User) GetByEmail(email string) (user *m.User, err error)

func (*User) GetById

func (n *User) GetById(userId int64) (user *m.User, err error)

func (*User) GetByResetPassToken

func (n *User) GetByResetPassToken(token string) (user *m.User, err error)

func (*User) List

func (n *User) List(limit, offset int64, orderBy, sort string) (list []*m.User, total int64, err error)

func (*User) NewToken

func (n *User) NewToken(u *m.User) (token string, err error)

func (*User) SignIn

func (n *User) SignIn(u *m.User, ipv4 string) (err error)

func (*User) Update

func (n *User) Update(user *m.User) (err error)

type UserMeta

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

func GetUserMetaAdaptor

func GetUserMetaAdaptor(d *gorm.DB) *UserMeta

func (*UserMeta) UpdateOrCreate

func (n *UserMeta) UpdateOrCreate(meta *m.UserMeta) (id int64, err error)

type Variable

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

func GetVariableAdaptor

func GetVariableAdaptor(d *gorm.DB) *Variable

func (*Variable) Add

func (n *Variable) Add(variables *m.Variable) (err error)

func (*Variable) Delete

func (n *Variable) Delete(name string) (err error)

func (*Variable) GetAllEnabled

func (n *Variable) GetAllEnabled() (list []*m.Variable, err error)

func (*Variable) GetByName

func (n *Variable) GetByName(name string) (variables *m.Variable, err error)

func (*Variable) List

func (n *Variable) List(limit, offset int64, orderBy, sort string) (list []*m.Variable, total int64, err error)

func (*Variable) Update

func (n *Variable) Update(variable *m.Variable) (err error)

type Worker

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

func GetWorkerAdaptor

func GetWorkerAdaptor(d *gorm.DB) *Worker

func (*Worker) Add

func (n *Worker) Add(worker *m.Worker) (id int64, err error)

func (*Worker) Delete

func (n *Worker) Delete(ids []int64) (err error)

func (*Worker) GetAllEnabled

func (n *Worker) GetAllEnabled() (list []*m.Worker, err error)

func (*Worker) GetById

func (n *Worker) GetById(workerId int64) (worker *m.Worker, err error)

func (*Worker) List

func (n *Worker) List(limit, offset int64, orderBy, sort string) (list []*m.Worker, total int64, err error)

func (*Worker) Update

func (n *Worker) Update(worker *m.Worker) (err error)

type Workflow

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

func GetWorkflowAdaptor

func GetWorkflowAdaptor(d *gorm.DB) *Workflow

func (*Workflow) Add

func (n *Workflow) Add(workflow *m.Workflow) (id int64, err error)

func (*Workflow) AddScript

func (n *Workflow) AddScript(workflow *m.Workflow, script *m.Script) (err error)

func (*Workflow) Delete

func (n *Workflow) Delete(workflowId int64) (err error)

func (*Workflow) DependencyLoading

func (n *Workflow) DependencyLoading(workflow *m.Workflow) (err error)

func (*Workflow) GetAllEnabled

func (n *Workflow) GetAllEnabled() (list []*m.Workflow, err error)

func (*Workflow) GetById

func (n *Workflow) GetById(workflowId int64) (workflow *m.Workflow, err error)

func (*Workflow) List

func (n *Workflow) List(limit, offset int64, orderBy, sort string) (list []*m.Workflow, total int64, err error)

func (*Workflow) RemoveScript

func (n *Workflow) RemoveScript(workflow *m.Workflow, script *m.Script) (err error)

func (*Workflow) Search

func (n *Workflow) Search(query string, limit, offset int) (list []*m.Workflow, total int64, err error)

func (*Workflow) SetScenario

func (n *Workflow) SetScenario(workflow *m.Workflow, s interface{}) (err error)

func (*Workflow) Update

func (n *Workflow) Update(workflow *m.Workflow) (err error)

func (*Workflow) UpdateScripts

func (n *Workflow) UpdateScripts(wf *m.Workflow) (err error)

type WorkflowScenario

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

func GetWorkflowScenarioAdaptor

func GetWorkflowScenarioAdaptor(d *gorm.DB) *WorkflowScenario

func (*WorkflowScenario) Add

func (n *WorkflowScenario) Add(workflow *m.WorkflowScenario) (id int64, err error)

func (*WorkflowScenario) AddScript

func (n *WorkflowScenario) AddScript(workflowScenario *m.WorkflowScenario, script *m.Script) (err error)

func (*WorkflowScenario) Delete

func (n *WorkflowScenario) Delete(workflowId int64) (err error)

func (*WorkflowScenario) GetById

func (n *WorkflowScenario) GetById(scenarioId int64) (workflow *m.WorkflowScenario, err error)

func (*WorkflowScenario) List

func (n *WorkflowScenario) List(limit, offset int64, orderBy, sort string) (list []*m.WorkflowScenario, total int64, err error)

func (*WorkflowScenario) ListByWorkflow

func (n *WorkflowScenario) ListByWorkflow(workflowId int64) (list []*m.WorkflowScenario, total int64, err error)

func (*WorkflowScenario) RemoveScript

func (n *WorkflowScenario) RemoveScript(workflowScenario *m.WorkflowScenario, script *m.Script) (err error)

func (*WorkflowScenario) Search

func (n *WorkflowScenario) Search(query string, limit, offset int) (list []*m.WorkflowScenario, total int64, err error)

func (*WorkflowScenario) Update

func (n *WorkflowScenario) Update(workflow *m.WorkflowScenario) (err error)

func (*WorkflowScenario) UpdateScripts

func (n *WorkflowScenario) UpdateScripts(wf *m.WorkflowScenario) (err error)

Jump to

Keyboard shortcuts

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