models

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2017 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const HISTORY_MAX = 8

Variables

This section is empty.

Functions

func AddConnection

func AddConnection(m *Connection) (id int64, err error)

AddConnection insert a new Connection into database and returns last inserted Id on success.

func AddDashboard

func AddDashboard(m *Dashboard) (id int64, err error)

AddDashboard insert a new Dashboard into database and returns last inserted Id on success.

func AddDevice

func AddDevice(m *Device) (id int64, err error)

AddDevice insert a new Device into database and returns last inserted Id on success.

func AddDeviceAction

func AddDeviceAction(m *DeviceAction) (id int64, err error)

AddDeviceAction insert a new DeviceAction into database and returns last inserted Id on success.

func AddDeviceState

func AddDeviceState(m *DeviceState) (id int64, err error)

AddDeviceState insert a new DeviceState into database and returns last inserted Id on success.

func AddFlow

func AddFlow(m *Flow) (id int64, err error)

AddFlow insert a new Flow into database and returns last inserted Id on success.

func AddFlowElement

func AddFlowElement(m *FlowElement) (id int64, err error)

AddFlowElement insert a new FlowElement into database and returns last inserted Id on success.

func AddImage

func AddImage(m *Image) (id int64, err error)

AddImage insert a new Image into database and returns last inserted Id on success.

func AddLog

func AddLog(m *Log) (id int64, err error)

AddLog insert a new Log into database and returns last inserted Id on success.

func AddMap

func AddMap(m *Map) (id int64, err error)

AddMap insert a new Map into database and returns last inserted Id on success.

func AddMapDevice

func AddMapDevice(m *MapDevice) (id int64, err error)

AddMapDevice insert a new MapDevice into database and returns last inserted Id on success.

func AddMapDeviceAction

func AddMapDeviceAction(m *MapDeviceAction) (id int64, err error)

AddMapDeviceAction insert a new MapDeviceAction into database and returns last inserted Id on success.

func AddMapDeviceState

func AddMapDeviceState(m *MapDeviceState) (id int64, err error)

AddMapDeviceState insert a new MapDeviceState into database and returns last inserted Id on success.

func AddMapElement

func AddMapElement(m *MapElement) (id int64, err error)

AddMapElement insert a new MapElement into database and returns last inserted Id on success.

func AddMapImage

func AddMapImage(m *MapImage) (id int64, err error)

AddMapImage insert a new MapImage into database and returns last inserted Id on success.

func AddMapLayer

func AddMapLayer(m *MapLayer) (id int64, err error)

AddMapLayer insert a new MapLayer into database and returns last inserted Id on success.

func AddMapText

func AddMapText(m *MapText) (id int64, err error)

AddMapText insert a new MapText into database and returns last inserted Id on success.

func AddMessage added in v0.0.5

func AddMessage(m *Message) (id int64, err error)

AddMessage insert a new Message into database and returns last inserted Id on success.

func AddMessageDeliverie added in v0.0.5

func AddMessageDeliverie(m *MessageDeliverie) (id int64, err error)

AddMessageDeliverie insert a new MessageDeliverie into database and returns last inserted Id on success.

func AddMessageDeliverieMultiple added in v0.0.5

func AddMessageDeliverieMultiple(mds []*MessageDeliverie) (count int64, _errors []error)

func AddMultipleFiles

func AddMultipleFiles(images []*Image) (ids []int64, errs []error)

AddMultipleFiles Use a prepared statement to increase inserting speed with multiple inserts.

func AddMultipleMapDeviceAction

func AddMultipleMapDeviceAction(actions []*MapDeviceAction) (ids []int64, errs []error)

AddMultipleMapDeviceAction Use a prepared statement to increase inserting speed with multiple inserts.

func AddMultipleMapDeviceState

func AddMultipleMapDeviceState(states []*MapDeviceState) (ids []int64, errs []error)

AddMultipleMapDeviceState Use a prepared statement to increase inserting speed with multiple inserts.

func AddNode

func AddNode(m *Node) (id int64, err error)

AddNode insert a new Node into database and returns last inserted Id on success.

func AddOrUpdateConnection

func AddOrUpdateConnection(m *Connection) (id int64, err error)

AddFlowElement insert a new FlowElement into database and returns last inserted Id on success.

func AddOrUpdateFlowElement

func AddOrUpdateFlowElement(m *FlowElement) (id int64, err error)

AddFlowElement insert a new FlowElement into database and returns last inserted Id on success.

func AddPermission

func AddPermission(m *Permission) (id int64, err error)

AddPermission insert a new Permission into database and returns last inserted Id on success.

func AddRole

func AddRole(m *Role) (id int64, err error)

AddRole insert a new Role into database and returns last inserted Name on success.

func AddScript

func AddScript(m *Script) (id int64, err error)

AddScript insert a new Script into database and returns last inserted Id on success.

func AddUser

func AddUser(m *User) (id int64, err error)

AddUser insert a new User into database and returns last inserted Id on success.

func AddUserMeta

func AddUserMeta(m *UserMeta) (id int64, err error)

AddUserMeta insert a new UserMeta into database and returns last inserted Id on success.

func AddWorker

func AddWorker(m *Worker) (id int64, err error)

AddWorker insert a new Worker into database and returns last inserted Id on success.

func AddWorkflow

func AddWorkflow(m *Workflow) (id int64, err error)

AddWorkflow insert a new Workflow into database and returns last inserted Id on success.

func AddWorkflowScenario added in v0.0.5

func AddWorkflowScenario(m *WorkflowScenario) (id int64, err error)

AddScenario insert a new Scenario into database and returns last inserted Id on success.

func DeleteConnection

func DeleteConnection(uuid string) (err error)

DeleteConnection deletes Connection by Id and returns error if the record to be deleted doesn't exist

func DeleteDashboard

func DeleteDashboard(id int64) (err error)

DeleteDashboard deletes Dashboard by Id and returns error if the record to be deleted doesn't exist

func DeleteDevice

func DeleteDevice(id int64) (err error)

DeleteDevice deletes Device by Id and returns error if the record to be deleted doesn't exist

func DeleteDeviceAction

func DeleteDeviceAction(id int64) (err error)

DeleteDeviceAction deletes DeviceAction by Id and returns error if the record to be deleted doesn't exist

func DeleteDeviceState

func DeleteDeviceState(id int64) (err error)

DeleteDeviceState deletes DeviceState by Id and returns error if the record to be deleted doesn't exist

func DeleteFlow

func DeleteFlow(id int64) (err error)

DeleteFlow deletes Flow by Id and returns error if the record to be deleted doesn't exist

func DeleteFlowElement

func DeleteFlowElement(uuid string) (err error)

DeleteFlowElement deletes FlowElement by Id and returns error if the record to be deleted doesn't exist

func DeleteImage

func DeleteImage(id int64) (err error)

DeleteImage deletes Image by Id and returns error if the record to be deleted doesn't exist

func DeleteLog

func DeleteLog(id int64) (err error)

DeleteLog deletes Log by Id and returns error if the record to be deleted doesn't exist

func DeleteMap

func DeleteMap(id int64) (err error)

DeleteMap deletes Map by Id and returns error if the record to be deleted doesn't exist

func DeleteMapDevice

func DeleteMapDevice(id int64) (err error)

DeleteMapDevice deletes MapDevice by Id and returns error if the record to be deleted doesn't exist

func DeleteMapDeviceAction

func DeleteMapDeviceAction(id int64) (err error)

DeleteMapDeviceAction deletes MapDeviceAction by Id and returns error if the record to be deleted doesn't exist

func DeleteMapDeviceState

func DeleteMapDeviceState(id int64) (err error)

DeleteMapDeviceState deletes MapDeviceState by Id and returns error if the record to be deleted doesn't exist

func DeleteMapElement

func DeleteMapElement(id int64) (err error)

DeleteMapElement deletes MapElement by Id and returns error if the record to be deleted doesn't exist

func DeleteMapImage

func DeleteMapImage(id int64) (err error)

DeleteMapImage deletes MapImage by Id and returns error if the record to be deleted doesn't exist

func DeleteMapLayer

func DeleteMapLayer(id int64) (err error)

DeleteMapLayer deletes MapLayer by Id and returns error if the record to be deleted doesn't exist

func DeleteMapText

func DeleteMapText(id int64) (err error)

DeleteMapText deletes MapText by Id and returns error if the record to be deleted doesn't exist

func DeleteMessage added in v0.0.5

func DeleteMessage(id int64) (err error)

DeleteMessage deletes Message by Id and returns error if the record to be deleted doesn't exist

func DeleteMessageDeliverie added in v0.0.5

func DeleteMessageDeliverie(id int64) (err error)

DeleteMessageDeliverie deletes MessageDeliverie by Id and returns error if the record to be deleted doesn't exist

func DeleteNode

func DeleteNode(id int64) (err error)

DeleteNode deletes Node by Id and returns error if the record to be deleted doesn't exist

func DeletePermission

func DeletePermission(id int64) (err error)

DeletePermission deletes Permission by Id and returns error if the record to be deleted doesn't exist

func DeleteRole

func DeleteRole(name string) (err error)

DeleteRole deletes Role by Name and returns error if the record to be deleted doesn't exist

func DeleteScript

func DeleteScript(id int64) (err error)

DeleteScript deletes Script by Id and returns error if the record to be deleted doesn't exist

func DeleteUser

func DeleteUser(id int64) (err error)

DeleteUser deletes User by Id and returns error if the record to be deleted doesn't exist

func DeleteUserMeta

func DeleteUserMeta(id int64) (err error)

DeleteUserMeta deletes UserMeta by Id and returns error if the record to be deleted doesn't exist

func DeleteVariable added in v0.0.7

func DeleteVariable(name string) (err error)

DeleteVariable deletes Variable by Name and returns error if the record to be deleted doesn't exist

func DeleteWorker

func DeleteWorker(id int64) (err error)

DeleteWorker deletes Worker by Id and returns error if the record to be deleted doesn't exist

func DeleteWorkflow

func DeleteWorkflow(id int64) (err error)

DeleteWorkflow deletes Workflow by Id and returns error if the record to be deleted doesn't exist

func DeleteWorkflowScenario added in v0.0.5

func DeleteWorkflowScenario(id int64) (err error)

DeleteScenario deletes Scenario by Id and returns error if the record to be deleted doesn't exist

func EmailItemAddNew

func EmailItemAddNew(body []byte) (id int64, b bool, valid validation.Validation, err error)

func EmailItemDelete

func EmailItemDelete(item_name string) (err error)

func EmailItemGetSortedList

func EmailItemGetSortedList() (count int, new_items []string, err error)

func EmailItemParentUpdate

func EmailItemParentUpdate(name, parent string) (err error)

func EmailItemUpdate

func EmailItemUpdate(body []byte, item_name string) (id int64, b bool, valid validation.Validation, err error)

func EmailItemUpdateTree

func EmailItemUpdateTree(body []byte) (err error)

func EmailTemplateAddNew

func EmailTemplateAddNew(body []byte) (id int64, b bool, valid validation.Validation, err error)

func EmailTemplateDelete

func EmailTemplateDelete(name string) (err error)

func EmailTemplatePreview

func EmailTemplatePreview(template *EmailTemplate) (buf string, err error)

func EmailTemplateUpdate

func EmailTemplateUpdate(body []byte, name string) (b bool, valid validation.Validation, err error)

func FlowGetRelatedDate

func FlowGetRelatedDate(flow *Flow) (err error)

func GetAllConnection

func GetAllConnection(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllConnection retrieves all Connection matches certain condition. Returns empty list if no records exist

func GetAllDashboard

func GetAllDashboard(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllDashboard retrieves all Dashboard matches certain condition. Returns empty list if no records exist

func GetAllDevice

func GetAllDevice(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllDevice retrieves all Device matches certain condition. Returns empty list if no records exist

func GetAllDeviceAction

func GetAllDeviceAction(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllDeviceAction retrieves all DeviceAction matches certain condition. Returns empty list if no records exist

func GetAllDeviceState

func GetAllDeviceState(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllDeviceState retrieves all DeviceState matches certain condition. Returns empty list if no records exist

func GetAllEmailTemplate added in v0.0.5

func GetAllEmailTemplate(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllEmailTemplates retrieves all EmailItem matches certain condition. Returns empty list if no records exist

func GetAllFlow

func GetAllFlow(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllFlow retrieves all Flow matches certain condition. Returns empty list if no records exist

func GetAllFlowElement

func GetAllFlowElement(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllFlowElement retrieves all FlowElement matches certain condition. Returns empty list if no records exist

func GetAllImage

func GetAllImage(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllImage retrieves all Image matches certain condition. Returns empty list if no records exist

func GetAllMap

func GetAllMap(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMap retrieves all Map matches certain condition. Returns empty list if no records exist

func GetAllMapDevice

func GetAllMapDevice(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMapDevice retrieves all MapDevice matches certain condition. Returns empty list if no records exist

func GetAllMapDeviceAction

func GetAllMapDeviceAction(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMapDeviceAction retrieves all MapDeviceAction matches certain condition. Returns empty list if no records exist

func GetAllMapDeviceState

func GetAllMapDeviceState(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMapDeviceState retrieves all MapDeviceState matches certain condition. Returns empty list if no records exist

func GetAllMapElement

func GetAllMapElement(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMapElement retrieves all MapElement matches certain condition. Returns empty list if no records exist

func GetAllMapImage

func GetAllMapImage(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMapImage retrieves all MapImage matches certain condition. Returns empty list if no records exist

func GetAllMapLayer

func GetAllMapLayer(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMapLayer retrieves all MapLayer matches certain condition. Returns empty list if no records exist

func GetAllMapText

func GetAllMapText(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMapText retrieves all MapText matches certain condition. Returns empty list if no records exist

func GetAllMessage added in v0.0.5

func GetAllMessage(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMessage retrieves all Message matches certain condition. Returns empty list if no records exist

func GetAllMessageDeliverie added in v0.0.5

func GetAllMessageDeliverie(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllMessageDeliverie retrieves all MessageDeliverie matches certain condition. Returns empty list if no records exist

func GetAllNode

func GetAllNode(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllNode retrieves all Node matches certain condition. Returns empty list if no records exist

func GetAllPermission

func GetAllPermission(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllPermission retrieves all Permission matches certain condition. Returns empty list if no records exist

func GetAllRole

func GetAllRole(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllRole retrieves all Role matches certain condition. Returns empty list if no records exist

func GetAllScript

func GetAllScript(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllScript retrieves all Script matches certain condition. Returns empty list if no records exist

func GetAllUser

func GetAllUser(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllUser retrieves all User matches certain condition. Returns empty list if no records exist

func GetAllUserMeta

func GetAllUserMeta(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllUserMeta retrieves all UserMeta matches certain condition. Returns empty list if no records exist

func GetAllWorker

func GetAllWorker(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllWorker retrieves all Worker matches certain condition. Returns empty list if no records exist

func GetAllWorkflow

func GetAllWorkflow(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllWorkflow retrieves all Workflow matches certain condition. Returns empty list if no records exist

func GetAllWorkflowScenario added in v0.0.5

func GetAllWorkflowScenario(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, meta *map[string]int64, err error)

GetAllScenario retrieves all Scenario matches certain condition. Returns empty list if no records exist

func GetDevicesCount

func GetDevicesCount() (total int64, err error)

func GetImageFilterList

func GetImageFilterList() (ml []orm.Params, err error)

GetImageFilterList

func GetNodesCount

func GetNodesCount() (total int64, err error)

func GetUserMeta

func GetUserMeta(u *User, key string) string

func InsertOrUpdateVariableByName added in v0.0.7

func InsertOrUpdateVariableByName(m *Variable) (err error)

InsertOrUpdateVariable updates Variable by Name and returns error if the record to be updated doesn't exist

func InsertOrUpdateWorker

func InsertOrUpdateWorker(worker *Worker) (id int64, err error)

func SetUserMeta

func SetUserMeta(u *User, key, value string) (err error)

func SortMapElements

func SortMapElements(m []*MapElement) (err error)

func SortMapLayers

func SortMapLayers(m []*MapLayer) (err error)

func UpdateConnectionById

func UpdateConnectionById(m *Connection) (err error)

UpdateConnection updates Connection by Id and returns error if the record to be updated doesn't exist

func UpdateDashboardById

func UpdateDashboardById(m *Dashboard) (err error)

UpdateDashboard updates Dashboard by Id and returns error if the record to be updated doesn't exist

func UpdateDeviceActionById

func UpdateDeviceActionById(m *DeviceAction) (err error)

UpdateDeviceAction updates DeviceAction by Id and returns error if the record to be updated doesn't exist

func UpdateDeviceById

func UpdateDeviceById(m *Device) (err error)

UpdateDevice updates Device by Id and returns error if the record to be updated doesn't exist

func UpdateDeviceStateById

func UpdateDeviceStateById(m *DeviceState) (err error)

UpdateDeviceState updates DeviceState by Id and returns error if the record to be updated doesn't exist

func UpdateFlowById

func UpdateFlowById(m *Flow) (err error)

UpdateFlow updates Flow by Id and returns error if the record to be updated doesn't exist

func UpdateFlowElementById

func UpdateFlowElementById(m *FlowElement) (err error)

UpdateFlowElement updates FlowElement by Id and returns error if the record to be updated doesn't exist

func UpdateImageById

func UpdateImageById(m *Image) (err error)

UpdateImage updates Image by Id and returns error if the record to be updated doesn't exist

func UpdateLogById

func UpdateLogById(m *Log) (err error)

UpdateLog updates Log by Id and returns error if the record to be updated doesn't exist

func UpdateMapById

func UpdateMapById(m *Map) (err error)

UpdateMap updates Map by Id and returns error if the record to be updated doesn't exist

func UpdateMapDeviceActionById

func UpdateMapDeviceActionById(m *MapDeviceAction) (err error)

UpdateMapDeviceAction updates MapDeviceAction by Id and returns error if the record to be updated doesn't exist

func UpdateMapDeviceById

func UpdateMapDeviceById(m *MapDevice) (err error)

UpdateMapDevice updates MapDevice by Id and returns error if the record to be updated doesn't exist

func UpdateMapDeviceStateById

func UpdateMapDeviceStateById(m *MapDeviceState) (err error)

UpdateMapDeviceState updates MapDeviceState by Id and returns error if the record to be updated doesn't exist

func UpdateMapElementById

func UpdateMapElementById(m *MapElement) (err error)

UpdateMapElement updates MapElement by Id and returns error if the record to be updated doesn't exist

func UpdateMapImageById

func UpdateMapImageById(m *MapImage) (err error)

UpdateMapImage updates MapImage by Id and returns error if the record to be updated doesn't exist

func UpdateMapLayerById

func UpdateMapLayerById(m *MapLayer) (err error)

UpdateMapLayer updates MapLayer by Id and returns error if the record to be updated doesn't exist

func UpdateMapTextById

func UpdateMapTextById(m *MapText) (err error)

UpdateMapText updates MapText by Id and returns error if the record to be updated doesn't exist

func UpdateMessageById added in v0.0.5

func UpdateMessageById(m *Message) (err error)

UpdateMessage updates Message by Id and returns error if the record to be updated doesn't exist

func UpdateMessageDeliverieById added in v0.0.5

func UpdateMessageDeliverieById(m *MessageDeliverie) (err error)

UpdateMessageDeliverie updates MessageDeliverie by Id and returns error if the record to be updated doesn't exist

func UpdateNodeById

func UpdateNodeById(m *Node) (err error)

UpdateNode updates Node by Id and returns error if the record to be updated doesn't exist

func UpdatePermissionById

func UpdatePermissionById(m *Permission) (err error)

UpdatePermission updates Permission by Id and returns error if the record to be updated doesn't exist

func UpdateRoleByName

func UpdateRoleByName(m *Role) (err error)

UpdateRole updates Role by Name and returns error if the record to be updated doesn't exist

func UpdateScriptById

func UpdateScriptById(m *Script) (err error)

UpdateScript updates Script by Id and returns error if the record to be updated doesn't exist

func UpdateUserById

func UpdateUserById(m *User) (err error)

UpdateUser updates User by Id and returns error if the record to be updated doesn't exist

func UpdateUserMetaById

func UpdateUserMetaById(m *UserMeta) (err error)

UpdateUserMeta updates UserMeta by Id and returns error if the record to be updated doesn't exist

func UpdateWorkerById

func UpdateWorkerById(m *Worker) (err error)

UpdateWorker updates Worker by Id and returns error if the record to be updated doesn't exist

func UpdateWorkflowById

func UpdateWorkflowById(m *Workflow) (err error)

UpdateWorkflow updates Workflow by Id and returns error if the record to be updated doesn't exist

func UpdateWorkflowScenarioById added in v0.0.5

func UpdateWorkflowScenarioById(m *WorkflowScenario) (err error)

UpdateScenario updates Scenario by Id and returns error if the record to be updated doesn't exist

Types

type AccessItem

type AccessItem struct {
	Actions     []string `json:"actions"`
	Method      string   `json:"method"`
	Description string   `json:"description"`
	RoleName    string   `json:"role_name"`
}

type AccessLevels

type AccessLevels map[string]AccessItem

func NewAccessLevels

func NewAccessLevels() AccessLevels

type AccessList

type AccessList map[string]AccessLevels
var AccessConfigList AccessList = nil

func NewAccessList

func NewAccessList() AccessList

type Connection

type Connection struct {
	Uuid            string       `orm:"pk" json:"uuid"`
	Name            string       `orm:"" json:"name"`
	ElementFrom     string       `orm:"column(element_from);type(string)" json:"element_from"`
	ElementTo       string       `orm:"column(element_to);type(string)" json:"element_to"`
	PointFrom       int64        `orm:"column(point_from)" json:"point_from"`
	PointTo         int64        `orm:"column(point_to)" json:"point_to"`
	FlowId          int64        `orm:"column(flow_id)" json:"flow_id"`
	Direction       string       `orm:"" json:"direction"`
	GraphSettings   string       `orm:"column(graph_settings)" json:"graph_settings"`
	Created_at      time.Time    `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at       time.Time    `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
	FlowElementFrom *FlowElement `orm:"-" json:"flow_elemet_from"`
	FlowElementTo   *FlowElement `orm:"-" json:"flow_elemet_to"`
	Flow            *Flow        `orm:"-" json:"flow"`
}

func GetConnectionById

func GetConnectionById(id string) (v *Connection, err error)

GetConnectionById retrieves Connection by Id. Returns error if Id doesn't exist

func GetConnectionsByFlow

func GetConnectionsByFlow(flow *Flow) (connections []*Connection, err error)

func (*Connection) TableName

func (m *Connection) TableName() string

type Dashboard

type Dashboard struct {
	Id          int64     `orm:"pk;auto;column(id)" json:"id"`
	Name        string    `orm:"" json:"name" valid:"MaxSize(254);Required"`
	Description string    `orm:"" json:"description"`
	Widgets     string    `orm:"" json:"widgets"`
	Created_at  time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetDashboardById

func GetDashboardById(id int64) (v *Dashboard, err error)

GetDashboardById retrieves Dashboard by Id. Returns error if Id doesn't exist

func (*Dashboard) TableName

func (m *Dashboard) TableName() string

type Device

type Device struct {
	Id          int64           `orm:"pk;auto;column(id)" json:"id"`
	Device      *Device         `orm:"rel(fk);null" json:"device"`
	Node        *Node           `orm:"rel(fk);null" json:"node"`
	Address     *int            `orm:"" json:"address"`
	Baud        int             `orm:"size(11)" json:"baud"`
	Sleep       int64           `orm:"size(32)" json:"sleep"`
	Description string          `orm:"size(254)" json:"description" valid:"MaxSize(254)"`
	Name        string          `orm:"size(254)" json:"name" valid:"MaxSize(254);Required"`
	Status      string          `orm:"size(254)" json:"status" valid:"MaxSize(254)"`
	StopBite    int64           `orm:"size(11)" json:"stop_bite"`
	Timeout     time.Duration   `orm:"" json:"timeout"`
	Tty         string          `orm:"size(254)" json:"tty" valid:"MaxSize(254)"`
	States      []*DeviceState  `orm:"reverse(many)" json:"states"`
	Actions     []*DeviceAction `orm:"reverse(many)" json:"actions"`
	Created_at  time.Time       `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time       `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
	IsGroup     bool            `orm:"-" json:"is_group"`
}

func GetDeviceById

func GetDeviceById(id int64) (v *Device, err error)

GetDeviceById retrieves Device by Id. Returns error if Id doesn't exist

func GetParentDeviceByChildId

func GetParentDeviceByChildId(id int64) (parent *Device, err error)

func (*Device) GetChilds

func (m *Device) GetChilds() (childs []*Device, all int64, err error)

func (*Device) GetInheritedData

func (m *Device) GetInheritedData() (err error)

func (*Device) GetNode

func (m *Device) GetNode() (*Node, error)

func (*Device) TableName

func (m *Device) TableName() string

type DeviceAction

type DeviceAction struct {
	Id     int64   `orm:"pk;auto;column(id)" json:"id"`
	Device *Device `orm:"rel(fk)" json:"device"`
	//Command 	string 		`orm:"" json:"command" valid:"Required"`
	Name        string    `orm:"size(254)" json:"name" valid:"MaxSize(254);Required"`
	Description string    `orm:"" json:"description"`
	Script      *Script   `orm:"rel(fk);null" json:"script"`
	Created_at  time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetAllDeviceActionByDevice

func GetAllDeviceActionByDevice(id int64) (actions []*DeviceAction, err error)

func GetDeviceActionById

func GetDeviceActionById(id int64) (v *DeviceAction, err error)

GetDeviceActionById retrieves DeviceAction by Id. Returns error if Id doesn't exist

func GetDeviceActionsByDeviceId

func GetDeviceActionsByDeviceId(ids []int64) (actions []*DeviceAction, err error)

func (*DeviceAction) TableName

func (m *DeviceAction) TableName() string

type DeviceState

type DeviceState struct {
	Id          int64     `orm:"pk;auto;column(id)" json:"id"`
	Device      *Device   `orm:"rel(fk);null" json:"device"`
	Description string    `orm:"size(254)" json:"description" valid:"MaxSize(254)"`
	SystemName  string    `orm:"size(254)" json:"system_name" valid:"MaxSize(254);Required"`
	Created_at  time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetAllDeviceStateByDevice

func GetAllDeviceStateByDevice(id int64) (states []*DeviceState, err error)

DeleteDeviceState

func GetDeviceStateById

func GetDeviceStateById(id int64) (v *DeviceState, err error)

GetDeviceStateById retrieves DeviceState by Id. Returns error if Id doesn't exist

func GetDeviceStatusesByDeviceId added in v0.0.7

func GetDeviceStatusesByDeviceId(ids []int64) (actions []*DeviceState, err error)

func (*DeviceState) TableName

func (i *DeviceState) TableName() string

type EmailItem

type EmailItem struct {
	Name        string    `orm:"pk;size(64);column(name);unique" valid:"Required;MaxSize(64)" json:"name"`
	Description string    `orm:"size(255)" json:"description"`
	Content     string    `orm:"" json:"content"`
	Status      string    `orm:"size(64)" valid:"Required;MaxSize(64)" json:"status"` //active, inactive
	Type        string    `orm:"size(64)" valid:"Required;MaxSize(64)" json:"type"`   //item, template
	Parent      string    `orm:"size(64)" valid:"MaxSize(64)" json:"parent"`
	Markers     []string  `orm:"-" json:"markers"`
	Created_at  time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Updated_at  time.Time `orm:"auto_now;type(datetime);column(updated_at)" json:"updated_at"`
}

func EmailItemGet

func EmailItemGet(item_name string) (item *EmailItem, err error)

func EmailTemplateGetByName

func EmailTemplateGetByName(name string) (template *EmailItem, err error)

func (*EmailItem) GetMarkers added in v0.0.5

func (i *EmailItem) GetMarkers() (markers []string, err error)

func (*EmailItem) GetTemplate

func (i *EmailItem) GetTemplate() (tpl *EmailTemplate, err error)

func (*EmailItem) TableName

func (i *EmailItem) TableName() string

type EmailRender

type EmailRender struct {
	Subject string
	Body    string
}

func EmailTemplateRender

func EmailTemplateRender(name string, params map[string]interface{}) (r *EmailRender, err error)

type EmailTemplate

type EmailTemplate struct {
	Items  []string `json:"items"`
	Title  string   `json:"title"`
	Fields []*Field `json:"fields"`
}

type Field

type Field struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Flow

type Flow struct {
	Id           int64             `orm:"pk;auto;column(id)" json:"id"`
	Name         string            `orm:"" json:"name"`
	Description  string            `orm:"" json:"description"`
	Status       string            `orm:"" json:"status"`
	Workflow     *Workflow         `orm:"rel(fk)" json:"workflow"`
	Scenario     *WorkflowScenario `orm:"rel(fk);column(workflow_scenario_id);null" json:"scenario"`
	Created_at   time.Time         `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at    time.Time         `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
	Connections  []*Connection     `orm:"-" json:"connections"`
	FlowElements []*FlowElement    `orm:"-" json:"flow_elements"`
	Workers      []*Worker         `orm:"-" json:"workers"`
}

func GetAllEnabledFlows

func GetAllEnabledFlows() (fs []*Flow, err error)

func GetAllEnabledFlowsByWf

func GetAllEnabledFlowsByWf(wf *Workflow) (flows []*Flow, err error)

func GetEnabledFlowById

func GetEnabledFlowById(id int64) (flow *Flow, err error)

func GetFlowById

func GetFlowById(id int64) (v *Flow, err error)

GetFlowById retrieves Flow by Id. Returns error if Id doesn't exist

func GetFullFlowById

func GetFullFlowById(id int64) (v *Flow, err error)

GetFlowById retrieves Flow by Id. Returns error if Id doesn't exist

func (*Flow) AddConnection

func (f *Flow) AddConnection(connection *Connection)

func (*Flow) GetAllEnabledWorkers

func (f *Flow) GetAllEnabledWorkers() (workers []*Worker, err error)

func (*Flow) GetScenario added in v0.0.5

func (f *Flow) GetScenario() (int64, error)

func (*Flow) GetWorkers

func (f *Flow) GetWorkers() (workers []*Worker, err error)

func (*Flow) TableName

func (m *Flow) TableName() string

type FlowElement

type FlowElement struct {
	Uuid          string        `orm:"pk" json:"uuid"`
	Script        *Script       `orm:"rel(fk);null" json:"script"`
	Name          string        `orm:"" json:"name"`
	Description   string        `orm:"" json:"description"`
	GraphSettings string        `orm:"column(graph_settings)" json:"graph_settings"`
	Status        string        `orm:"" json:"status"`
	FlowId        int64         `orm:"column(flow_id)" json:"flow_id"`
	FlowLink      sql.NullInt64 `orm:"column(flow_link)" json:"flow"`
	Created_at    time.Time     `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at     time.Time     `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
	PrototypeType string        `orm:"column(prototype_type)" json:"prototype_type"`
}

func GetFlowElementById

func GetFlowElementById(uuid string) (v *FlowElement, err error)

GetFlowElementById retrieves FlowElement by Id. Returns error if Id doesn't exist

func GetFlowElementsByFlow

func GetFlowElementsByFlow(flow *Flow) (elements []*FlowElement, err error)

func (*FlowElement) TableName

func (m *FlowElement) TableName() string

type Image

type Image struct {
	Id         int64     `orm:"pk;auto;column(id)" json:"id"`
	Thumb      string    `orm:"" json:"thumb"`
	Url        string    `orm:"-" json:"url"`
	Image      string    `orm:"" json:"image"`
	MimeType   string    `orm:"" json:"mime_type"`
	Title      string    `orm:"" json:"title"`
	Size       int64     `orm:"" json:"size"`
	Name       string    `orm:"" json:"name"`
	Created_at time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
}

func GetAllImagesByDate

func GetAllImagesByDate(filter string) (images []Image, err error)

GetAllImagesByDate

func GetImageById

func GetImageById(id int64) (v *Image, err error)

GetImageById retrieves Image by Id. Returns error if Id doesn't exist

func UploadImages

func UploadImages(files map[string][]*multipart.FileHeader) (fileList []*Image, errs []error)

func (*Image) GetUrl

func (m *Image) GetUrl()

func (*Image) TableName

func (i *Image) TableName() string

type Items

type Items []*EmailItem

func EmailItemGetList

func EmailItemGetList() (count int64, items Items, err error)

func (Items) Len

func (i Items) Len() int

func (Items) Less

func (i Items) Less(a, b int) bool

func (Items) Swap

func (i Items) Swap(a, b int)

type Log

type Log struct {
	Id         int64     `orm:"pk;auto;column(id)" json:"id"`
	Body       string    `orm:"" json:"body"`
	Level      string    `orm:"" json:"level"`
	Created_at time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
}

func GetAllLog

func GetAllLog(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (logs []Log, meta *map[string]int64, err error)

GetAllLog retrieves all Log matches certain condition. Returns empty list if no records exist

func GetLogById

func GetLogById(id int64) (v *Log, err error)

GetLogById retrieves Log by Id. Returns error if Id doesn't exist

func (*Log) TableName

func (m *Log) TableName() string

type Map

type Map struct {
	Id          int64       `orm:"pk;auto;column(id)" json:"id"`
	Name        string      `orm:"" json:"name" valid:"MaxSize(254);Required"`
	Description string      `orm:"" json:"description"`
	Layers      []*MapLayer `orm:"reverse(many)" json:"layers"`
	Options     string      `orm:"" json:"options"`
	Created_at  time.Time   `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time   `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetMapById

func GetMapById(id int64) (v *Map, err error)

GetMapById retrieves Map by Id. Returns error if Id doesn't exist

func (*Map) TableName

func (m *Map) TableName() string

type MapDevice

type MapDevice struct {
	Id         int64              `orm:"pk;auto;column(id)" json:"id"`
	Device     *Device            `orm:"rel(fk)" json:"device"`
	Image      *Image             `orm:"rel(fk);null" json:"image"`
	States     []*MapDeviceState  `orm:"reverse(many)" json:"states"`
	Actions    []*MapDeviceAction `orm:"reverse(many)" json:"actions"`
	Created_at time.Time          `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at  time.Time          `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetMapDeviceById

func GetMapDeviceById(id int64) (v *MapDevice, err error)

GetMapDeviceById retrieves MapDevice by Id. Returns error if Id doesn't exist

func (*MapDevice) TableName

func (m *MapDevice) TableName() string

type MapDeviceAction

type MapDeviceAction struct {
	Id           int64         `orm:"pk;auto;column(id)" json:"id"`
	Type         string        `orm:"" json:"type"`
	MapDevice    *MapDevice    `orm:"rel(fk)" json:"map_device"`
	DeviceAction *DeviceAction `orm:"rel(fk)" json:"device_action"`
	Image        *Image        `orm:"rel(fk);null" json:"image"`
	Created_at   time.Time     `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at    time.Time     `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetMapDeviceActionById

func GetMapDeviceActionById(id int64) (v *MapDeviceAction, err error)

GetMapDeviceActionById retrieves MapDeviceAction by Id. Returns error if Id doesn't exist

func (*MapDeviceAction) TableName

func (m *MapDeviceAction) TableName() string

type MapDeviceState

type MapDeviceState struct {
	Id          int64        `orm:"pk;auto;column(id)" json:"id"`
	Style       string       `orm:"" json:"style"`
	MapDevice   *MapDevice   `orm:"rel(fk)" json:"map_device"`
	DeviceState *DeviceState `orm:"rel(fk)" json:"device_state"`
	Image       *Image       `orm:"rel(fk);null" json:"image"`
	Created_at  time.Time    `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time    `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetMapDeviceStateById

func GetMapDeviceStateById(id int64) (v *MapDeviceState, err error)

GetMapDeviceStateById retrieves MapDeviceState by Id. Returns error if Id doesn't exist

func (*MapDeviceState) TableName

func (m *MapDeviceState) TableName() string

type MapElement

type MapElement struct {
	Id            int64       `orm:"pk;auto;column(id)" json:"id"`
	Name          string      `orm:"" json:"name"`
	Description   string      `orm:"" json:"description"`
	Status        string      `orm:"" json:"status"`
	PrototypeType string      `orm:"" json:"prototype_type"`
	PrototypeId   int64       `orm:"" json:"prototype_id"`
	Prototype     interface{} `orm:"-" json:"prototype"`
	Weight        int64       `orm:"" json:"weight"`
	Layer         *MapLayer   `orm:"rel(fk)" json:"layer"`
	Map           *Map        `orm:"rel(fk)" json:"map"`
	GraphSettings string      `orm:"column(graph_settings)" json:"graph_settings"`
	Created_at    time.Time   `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at     time.Time   `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetMapElementById

func GetMapElementById(id int64) (v *MapElement, err error)

GetMapElementById retrieves MapElement by Id. Returns error if Id doesn't exist

func (*MapElement) CompareWith

func (m *MapElement) CompareWith(element *MapElement) bool

func (*MapElement) GetPrototype

func (m *MapElement) GetPrototype() (*MapElement, error)

func (*MapElement) TableName

func (m *MapElement) TableName() string

type MapImage

type MapImage struct {
	Id    int64  `orm:"pk;auto;column(id)" json:"id"`
	Image *Image `orm:"rel(fk)" json:"image"`
	Style string `orm:"" json:"style"`
}

func GetMapImageById

func GetMapImageById(id int64) (v *MapImage, err error)

GetMapImageById retrieves MapImage by Id. Returns error if Id doesn't exist

func (*MapImage) TableName

func (m *MapImage) TableName() string

type MapLayer

type MapLayer struct {
	Id          int64         `orm:"pk;auto;column(id)" json:"id"`
	Name        string        `orm:"" json:"name"`
	Status      string        `orm:"" json:"status"`
	Description string        `orm:"" json:"description"`
	Weight      int64         `orm:"" json:"weight"`
	Map         *Map          `orm:"rel(fk)" json:"map"`
	Elements    []*MapElement `orm:"reverse(many)" json:"elements"`
	Created_at  time.Time     `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time     `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetMapLayerById

func GetMapLayerById(id int64) (v *MapLayer, err error)

GetMapLayerById retrieves MapLayer by Id. Returns error if Id doesn't exist

func (*MapLayer) TableName

func (m *MapLayer) TableName() string

type MapText

type MapText struct {
	Id    int64  `orm:"pk;auto;column(id)" json:"id"`
	Text  string `orm:"" json:"text"`
	Style string `orm:"" json:"style"`
}

func GetMapTextById

func GetMapTextById(id int64) (v *MapText, err error)

GetMapTextById retrieves MapText by Id. Returns error if Id doesn't exist

func (*MapText) TableName

func (m *MapText) TableName() string

type Message added in v0.0.5

type Message struct {
	Id           int64     `orm:"pk;auto;column(id)" json:"id"`
	Type         string    `orm:"size(254)" json:"type" valid:"Required"`
	EmailTitle   string    `orm:"" json:"email_title"`
	EmailBody    string    `orm:"" json:"email_body"`
	Sms_text     string    `orm:"" json:"sms_text"`
	Ui_text      string    `orm:"" json:"ui_text"`
	Scheduled_at time.Time `orm:"auto_now_add;type(datetime);column(scheduled_at)" json:"scheduled_at"`
	Created_at   time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at    time.Time `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
	Deleted_at   time.Time `orm:"column(deleted_at);null" json:"deleted_at"`
}

func GetMessageById added in v0.0.5

func GetMessageById(id int64) (v *Message, err error)

GetMessageById retrieves Message by Id. Returns error if Id doesn't exist

func (*Message) TableName added in v0.0.5

func (m *Message) TableName() string

type MessageDeliverie added in v0.0.5

type MessageDeliverie struct {
	Id                   int64     `orm:"pk;auto;column(id)" json:"id"`
	Message              *Message  `orm:"rel(fk)" json:"message"`
	State                string    `orm:"size(254)" json:"state"`
	Address              string    `orm:"" json:"address"`
	Error_system_code    string    `orm:"size(254)" json:"error_system_code"`
	Error_system_message string    `orm:"size(254)" json:"error_system_message"`
	Created_at           time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at            time.Time `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetAllMessageDeliveriesInProgress added in v0.0.5

func GetAllMessageDeliveriesInProgress() (messages []*MessageDeliverie, count int64, err error)

func GetMessageDeliverieById added in v0.0.5

func GetMessageDeliverieById(id int64) (v *MessageDeliverie, err error)

GetMessageDeliverieById retrieves MessageDeliverie by Id. Returns error if Id doesn't exist

func (*MessageDeliverie) TableName added in v0.0.5

func (m *MessageDeliverie) TableName() string

type Node

type Node struct {
	Id          int64     `orm:"pk;auto;column(id)" json:"id"`
	Name        string    `orm:"size(254)" json:"name" valid:"MaxSize(254);Required"`
	Ip          string    `orm:"size(128)" json:"ip" valid:"IP;Required"` // Must be a valid IPv4 address
	Port        int       `orm:"size(11)" json:"port" valid:"Range(1, 65535);Required"`
	Status      string    `orm:"size(254)" json:"status"`
	Description string    `orm:"type(longtext)" json:"description"`
	Created_at  time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`

	Errors int64 `orm:"-" json:"-"`
	// contains filtered or unexported fields
}

func GetAllEnabledNodes

func GetAllEnabledNodes() (nodes []*Node, err error)

func GetNodeById

func GetNodeById(id int64) (v *Node, err error)

GetNodeById retrieves Node by Id. Returns error if Id doesn't exist

func (*Node) GetConn

func (n *Node) GetConn() net.Conn

func (*Node) GetConnectStatus

func (n *Node) GetConnectStatus() string

func (*Node) GetVersion

func (n *Node) GetVersion() (version string, err error)

func (*Node) ModbusSend

func (n *Node) ModbusSend(device *Device, return_result bool, command []byte, reply interface{}) error

func (*Node) RpcCall added in v0.0.7

func (n *Node) RpcCall(method string, request interface{}, reply interface{}) error

func (*Node) RpcDial

func (n *Node) RpcDial() (*rpc.Client, error)

func (*Node) Send

func (n *Node) Send(protocol string, device *Device, return_result bool, command []byte) (result common.Result)

func (*Node) SetConnectStatus

func (n *Node) SetConnectStatus(st string)

func (*Node) TableName

func (m *Node) TableName() string

func (*Node) TcpClose

func (n *Node) TcpClose()

func (*Node) TcpDial

func (n *Node) TcpDial() (net.Conn, error)

func (*Node) Valid

func (n *Node) Valid(v *validation.Validation)

type Permission

type Permission struct {
	Id          int64  `orm:"pk;auto" json:"id"`
	Role        *Role  `orm:"rel(fk);column(role_name)" json:"-"`
	PackageName string `orm:"" json:"package_name"`
	LevelName   string `orm:"" json:"level_name"`
}

func GetPermissionById

func GetPermissionById(id int64) (v *Permission, err error)

GetPermissionById retrieves Permission by Id. Returns error if Id doesn't exist

func (*Permission) TableName

func (m *Permission) TableName() string

type RedactorConnector

type RedactorConnector struct {
	Id    string `json:"id"`
	Start struct {
		Object string `json:"object"`
		Point  int64  `json:"point"`
	} `json:"start"`
	End struct {
		Object string `json:"object"`
		Point  int64  `json:"point"`
	} `json:"end"`
	Flow_type string `json:"flow_type"`
	Title     string `json:"title"`
	Direction string `json:"direction"`
}

type RedactorFlow

type RedactorFlow struct {
	Id          int64                `json:"id"`
	Name        string               `json:"name"`
	Description string               `json:"description"`
	Status      string               `json:"status"`
	Objects     []*RedactorObject    `json:"objects"`
	Connectors  []*RedactorConnector `json:"connectors"`
	Created_at  time.Time            `json:"created_at"`
	Update_at   time.Time            `json:"update_at"`
	Workflow    *Workflow            `json:"workflow"`
	Scenario    *WorkflowScenario    `json:"scenario"`
	Workers     []*Worker            `json:"workers"`
}

type RedactorGrapSettings

type RedactorGrapSettings struct {
	Position struct {
		Top  int64 `json:"top"`
		Left int64 `json:"left"`
	} `json:"position"`
}

type RedactorObject

type RedactorObject struct {
	Id   string `json:"id"`
	Type struct {
		Name   string      `json:"name"`
		Start  interface{} `json:"start"`
		End    interface{} `json:"end"`
		Status string      `json:"status"`
		Action string      `json:"action"`
	} `json:"type"`
	Position struct {
		Top  int64 `json:"top"`
		Left int64 `json:"left"`
	} `json:"position"`
	Status        string  `json:"status"`
	Error         string  `json:"error"`
	Title         string  `json:"title"`
	Description   string  `json:"description"`
	PrototypeType string  `json:"prototype_type"`
	Script        *Script `json:"script"`
	FlowLink      *Flow   `json:"flow_link"`
}

type Role

type Role struct {
	Name        string              `orm:"pk;unique;size(255);index" valid:"Required;MaxSize(255)" json:"name"`
	Description string              `orm:"size(255)" json:"description"`
	Parent      *Role               `orm:"rel(fk);column(parent);null" json:"parent"`
	Children    []*Role             `orm:"reverse(many)" json:"children"`
	Permissions []*Permission       `orm:"reverse(many)" json:"-"`
	AccessList  map[string][]string `orm:"-" json:"access_list"`
	Created_at  time.Time           `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time           `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetRoleByName

func GetRoleByName(name string) (v *Role, err error)

GetRoleById retrieves Role by Name. Returns error if Name doesn't exist

func (*Role) GetAccessList

func (r *Role) GetAccessList()

func (*Role) GetFullAccessList

func (r *Role) GetFullAccessList() (access_list AccessList)

func (*Role) LoadRelated

func (r *Role) LoadRelated() (err error)

func (*Role) TableName

func (m *Role) TableName() string

func (*Role) UpdateAccessList

func (r *Role) UpdateAccessList(access_list map[string]map[string]bool) (err error)

type Script

type Script struct {
	Id          int64     `orm:"pk;auto;column(id)" json:"id"`
	Name        string    `orm:"size(254)" json:"name" valid:"MaxSize(254);Required"`
	Source      string    `orm:"type(longtext)" json:"source"`
	Compiled    string    `orm:"type(longtext)" json:"-"`
	Lang        string    `orm:"size(254)" json:"lang"`
	Description string    `orm:"type(longtext)" json:"description"`
	Created_at  time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetScriptById

func GetScriptById(id int64) (v *Script, err error)

GetScriptById retrieves Script by Id. Returns error if Id doesn't exist

func (*Script) TableName

func (m *Script) TableName() string

type SortMapElementByWeight

type SortMapElementByWeight []*MapElement

func (SortMapElementByWeight) Len

func (l SortMapElementByWeight) Len() int

func (SortMapElementByWeight) Less

func (l SortMapElementByWeight) Less(i, j int) bool

func (SortMapElementByWeight) Swap

func (l SortMapElementByWeight) Swap(i, j int)

type SortMapLayersByWeight

type SortMapLayersByWeight []*MapLayer

func (SortMapLayersByWeight) Len

func (l SortMapLayersByWeight) Len() int

func (SortMapLayersByWeight) Less

func (l SortMapLayersByWeight) Less(i, j int) bool

func (SortMapLayersByWeight) Swap

func (l SortMapLayersByWeight) Swap(i, j int)

type Tree

type Tree struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Status      string  `json:"status"`
	Nodes       []*Tree `json:"nodes"`
}

func EmailItemGetTree

func EmailItemGetTree() (tree *Tree, err error)

type User

type User struct {
	Id                  int64          `orm:"pk;auto" json:"id"`
	Nickname            string         `orm:"size(255)" valid:"Required;MinSize(3);MaxSize(255)" json:"nickname"`
	FirstName           string         `orm:"size(255)" valid:"MaxSize(255)" json:"first_name"`
	LastName            string         `orm:"size(255)" valid:"MaxSize(255)" json:"last_name"`
	EncryptedPassword   string         `orm:"size(255)" valid:"Required;MaxSize(255)" json:"-"`
	Email               string         `orm:"size(255)" valid:"Required;Email" json:"email"`
	HistoryStr          string         `orm:"column(history)" json:"-"`
	History             []*UserHistory `orm:"-" json:"history"`
	Status              string         `orm:"size(255);default(blocked)" valid:"MaxSize(255)" json:"status"` //active, blocked
	ResetPasswordToken  string         `orm:"size(255)" json:"-"`
	AuthenticationToken string         `orm:"size(255)" valid:"MaxSize(255)" json:"-"`
	Avatar              *Image         `orm:"rel(fk);null;column(image_id)" json:"avatar"`
	SignInCount         int64          `orm:"size(11)" json:"sign_in_count"`
	CurrentSignInIp     string         `orm:"size(255);default(null)" json:"current_sign_in_ip"`
	LastSignInIp        string         `orm:"size(255);default(null)" json:"last_sign_in_ip"`
	Lang                string         `orm:"size(255);default(en)" json:"lang"`

	CreatedBy *User       `orm:"rel(fk);null;column(user_id)" json:"created_by"`
	Role      *Role       `orm:"rel(fk);null;column(role_name)" json:"role"`
	Meta      []*UserMeta `orm:"reverse(many);null" json:"meta"`

	ResetPasswordSentAt time.Time `orm:"type(datetime)" json:"-"`
	CurrentSignInAt     time.Time `orm:"type(datetime);null;default(null)" json:"current_sign_in_at"`
	LastSignInAt        time.Time `orm:"type(datetime);null;default(null)" json:"last_sign_in_at"`
	Created_at          time.Time `orm:"auto_now_add;type(datetime)" json:"created_at"`
	Update_at           time.Time `orm:"auto_now;type(datetime)" json:"update_at"`
	Deleted             time.Time `orm:"type(datetime);null;default(null)" json:"deleted"`
}

func GetUserById

func GetUserById(id int64) (v *User, err error)

GetUserById retrieves User by Id. Returns error if Id doesn't exist

func UserGetByAuthenticationToken

func UserGetByAuthenticationToken(token string) (user *User, err error)

func UserGetByEmail

func UserGetByEmail(email string) (user *User, err error)

func UserGetByResetPassToken

func UserGetByResetPassToken(token string) (user *User, err error)

func (*User) ClearResetPassToken

func (u *User) ClearResetPassToken() error

func (*User) GenResetPassToken

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

func (*User) GetHistory

func (u *User) GetHistory() (err error)

func (*User) GetMeta

func (u *User) GetMeta(key string) string

GetMeta

func (*User) LoadRelated

func (u *User) LoadRelated() (err error)

func (*User) NewToken

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

func (*User) SetMeta

func (u *User) SetMeta(key, value string) (err error)

SetMeta

func (*User) SetToken

func (u *User) SetToken(token string) error

func (*User) SignIn

func (u *User) SignIn(ipv4 string)

func (*User) TableName

func (m *User) TableName() string

func (*User) UpdateHistory

func (u *User) UpdateHistory(t time.Time, ipv4 string)

etc

func (*User) UpdatePassword

func (u *User) UpdatePassword(password string) (err error)

type UserHistory

type UserHistory struct {
	Ip   string    `json:"ip"`
	Time time.Time `json:"time"`
}

type UserMeta

type UserMeta struct {
	Id    int64  `orm:"pk;auto" json:"id"`
	User  *User  `orm:"rel(fk)" json:"-"`
	Key   string `orm:"size(255)" valid:"MaxSize(255)" json:"key"`
	Value string `orm:"size(255)" valid:"MaxSize(255)" json:"value"`
}

func GetUserMetaById

func GetUserMetaById(id int64) (v *UserMeta, err error)

GetUserMetaById retrieves UserMeta by Id. Returns error if Id doesn't exist

func (*UserMeta) TableName

func (m *UserMeta) TableName() string

type Variable added in v0.0.7

type Variable struct {
	Name     string `orm:"pk;size(128);unique;column(name)" json:"name"`
	Value    string `orm:"column(value)" json:"value"`
	Autoload string `orm:"default(yes);column(autoload)" json:"autoload"`
}

func GetAllVariable added in v0.0.7

func GetAllVariable() (variables []*Variable, err error)

GetAllVariable retrieves all Variable matches certain condition. Returns empty list if no records exist

func GetVariableByName added in v0.0.7

func GetVariableByName(name string) (v *Variable, err error)

GetVariableByName retrieves Variable by Name. Returns error if Name doesn't exist

func (*Variable) TableName added in v0.0.7

func (m *Variable) TableName() string

type Worker

type Worker struct {
	Id           int64         `orm:"pk;auto;column(id)" json:"id"`
	Workflow     *Workflow     `orm:"rel(fk)" json:"workflow" valid:"Required"`
	DeviceAction *DeviceAction `orm:"rel(fk);column(device_action_id);null" json:"device_action"`
	Flow         *Flow         `orm:"rel(fk)" json:"flow" valid:"Required"`
	Status       string        `orm:"size(254)" json:"status" valid:"Required"`
	Name         string        `orm:"size(254)" json:"name" valid:"MaxSize(254);Required"`
	Time         string        `orm:"size(254)" json:"time"`
	Created_at   time.Time     `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at    time.Time     `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetAllEnabledWorkersByFlow

func GetAllEnabledWorkersByFlow(flow *Flow) (workers []*Worker, err error)

func GetAllEnabledWorkersByWorkflow

func GetAllEnabledWorkersByWorkflow(workflow *Workflow) (workers []*Worker, err error)

func GetWorkerById

func GetWorkerById(id int64) (v *Worker, err error)

GetWorkerById retrieves Worker by Id. Returns error if Id doesn't exist

func GetWorkersByDeviceAction

func GetWorkersByDeviceAction(device_action *DeviceAction) (workers []*Worker, err error)

func GetWorkersByFlow

func GetWorkersByFlow(flow *Flow) (workers []*Worker, err error)

func GetWorkersByFlowId

func GetWorkersByFlowId(id int64) (workers []*Worker, err error)

func (*Worker) TableName

func (m *Worker) TableName() string

type Workflow

type Workflow struct {
	Id          int64               `orm:"pk;auto;column(id)" json:"id"`
	Name        string              `orm:"" json:"name"`
	Description string              `orm:"" json:"description"`
	Status      string              `orm:"" json:"status"`
	Scenario    *WorkflowScenario   `orm:"rel(fk);column(workflow_scenario_id);null" json:"scenario"`
	Scenarios   []*WorkflowScenario `orm:"reverse(many)" json:"scenarios"`
	Scripts     []*Script           `orm:"rel(m2m);rel_through(github.com/e154/smart-home/api/models.WorkflowScript)" json:"scripts"`
	Flows       []*Flow             `orm:"-" json:"flows"`
	Created_at  time.Time           `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at   time.Time           `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetAllEnabledWorkflow

func GetAllEnabledWorkflow() (wfs []*Workflow, err error)

func GetWorkflowById

func GetWorkflowById(id int64) (v *Workflow, err error)

GetWorkflowById retrieves Workflow by Id. Returns error if Id doesn't exist

func (*Workflow) AddScripts added in v0.0.5

func (wf *Workflow) AddScripts(scripts []*Script) (num int64, err error)

func (*Workflow) GetAllEnabledFlows

func (wf *Workflow) GetAllEnabledFlows() (flows []*Flow, err error)

func (*Workflow) GetAllEnabledWorkers

func (wf *Workflow) GetAllEnabledWorkers() ([]*Worker, error)

func (*Workflow) GetScenario added in v0.0.5

func (wf *Workflow) GetScenario() (int64, error)

func (*Workflow) GetScenarioById added in v0.0.5

func (wf *Workflow) GetScenarioById(id int64) (scenario *WorkflowScenario, err error)

func (*Workflow) GetScenarios added in v0.0.5

func (wf *Workflow) GetScenarios() (int64, error)

func (*Workflow) GetScripts added in v0.0.5

func (wf *Workflow) GetScripts() (int64, error)

func (*Workflow) RemoveScripts added in v0.0.5

func (wf *Workflow) RemoveScripts(scripts []*Script) (num int64, err error)

func (*Workflow) TableName

func (m *Workflow) TableName() string

func (*Workflow) UpdateScripts added in v0.0.5

func (wf *Workflow) UpdateScripts(scripts []*Script) (num int64, err error)

type WorkflowScenario added in v0.0.5

type WorkflowScenario struct {
	Id         int64     `orm:"auto" json:"id"`
	Name       string    `orm:"size(255)" json:"name"`
	Workflow   *Workflow `orm:"rel(fk)" json:"workflow"`
	Scripts    []*Script `orm:"rel(m2m);rel_through(github.com/e154/smart-home/api/models.WorkflowScenarioScript)" json:"scripts"`
	SystemName string    `orm:"size(255)" json:"system_name"`
	Created_at time.Time `orm:"auto_now_add;type(datetime);column(created_at)" json:"created_at"`
	Update_at  time.Time `orm:"auto_now;type(datetime);column(update_at)" json:"update_at"`
}

func GetWorkflowScenarioById added in v0.0.5

func GetWorkflowScenarioById(id int64) (v *WorkflowScenario, err error)

GetScenarioById retrieves Scenario by Id. Returns error if Id doesn't exist

func (*WorkflowScenario) AddScripts added in v0.0.5

func (wf *WorkflowScenario) AddScripts(scripts []*Script) (num int64, err error)

func (*WorkflowScenario) GetScripts added in v0.0.5

func (ws *WorkflowScenario) GetScripts() (int64, error)

func (*WorkflowScenario) RemoveScripts added in v0.0.5

func (wf *WorkflowScenario) RemoveScripts(scripts []*Script) (num int64, err error)

func (*WorkflowScenario) TableName added in v0.0.5

func (m *WorkflowScenario) TableName() string

func (*WorkflowScenario) UpdateScripts added in v0.0.5

func (wf *WorkflowScenario) UpdateScripts(scripts []*Script) (num int64, err error)

type WorkflowScenarioScript added in v0.0.5

type WorkflowScenarioScript struct {
	Id       int64             `orm:"pk;auto" json:"id"`
	Scenario *WorkflowScenario `orm:"rel(fk);column(workflow_scenario_id)" json:"scenario"`
	Script   *Script           `orm:"rel(fk);column(script_id)" json:"script"`
}

func (*WorkflowScenarioScript) TableName added in v0.0.5

func (m *WorkflowScenarioScript) TableName() string

type WorkflowScript added in v0.0.5

type WorkflowScript struct {
	Id       int64     `orm:"pk;auto" json:"id"`
	Workflow *Workflow `orm:"rel(fk);column(workflow_id)" json:"workflow"`
	Script   *Script   `orm:"rel(fk);column(script_id)" json:"script"`
}

func (*WorkflowScript) TableName added in v0.0.5

func (m *WorkflowScript) TableName() string

Jump to

Keyboard shortcuts

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