db

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Uuid          uuid.UUID `gorm:"primary_key"`
	Name          string
	ElementFrom   uuid.UUID
	ElementTo     uuid.UUID
	PointFrom     int64
	PointTo       int64
	Flow          *Flow
	FlowId        int64
	Direction     string
	GraphSettings json.RawMessage `gorm:"type:jsonb;not null"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (*Connection) TableName

func (d *Connection) TableName() string

type Connections

type Connections struct {
	Db *gorm.DB
}

func (Connections) Add

func (n Connections) Add(connection *Connection) (id uuid.UUID, err error)

func (Connections) Delete

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

func (Connections) GetById

func (n Connections) GetById(id uuid.UUID) (connection *Connection, err error)

func (*Connections) List

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

func (Connections) Update

func (n Connections) Update(m *Connection) (err error)

type Device

type Device struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Description string
	Device      *Device `gorm:"foreignkey:DeviceId"`
	DeviceId    sql.NullInt64
	Node        *Node
	NodeId      sql.NullInt64
	Status      string
	Type        common.DeviceType
	Properties  json.RawMessage `gorm:"type:jsonb;not null"`
	States      []*DeviceState
	Actions     []*DeviceAction
	Devices     []*Device
	IsGroup     bool
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*Device) TableName

func (m *Device) TableName() string

type DeviceAction

type DeviceAction struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Description string
	Device      *Device
	DeviceId    int64 `gorm:"column:device_id"`
	Script      *Script
	ScriptId    int64
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*DeviceAction) TableName

func (m *DeviceAction) TableName() string

type DeviceActions

type DeviceActions struct {
	Db *gorm.DB
}

func (DeviceActions) Add

func (n DeviceActions) Add(action *DeviceAction) (id int64, err error)

func (DeviceActions) Delete

func (n DeviceActions) Delete(actionId int64) (err error)

func (DeviceActions) GetByDeviceId

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

func (DeviceActions) GetById

func (n DeviceActions) GetById(actionId int64) (action *DeviceAction, err error)

func (*DeviceActions) List

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

func (*DeviceActions) Search

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

func (DeviceActions) Update

func (n DeviceActions) Update(m *DeviceAction) (err error)

type DeviceState

type DeviceState struct {
	Id          int64 `gorm:"primary_key"`
	Device      *Device
	DeviceId    int64 `gorm:"column:device_id"`
	Description string
	SystemName  string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*DeviceState) TableName

func (m *DeviceState) TableName() string

type DeviceStates

type DeviceStates struct {
	Db *gorm.DB
}

func (DeviceStates) Add

func (n DeviceStates) Add(state *DeviceState) (id int64, err error)

func (DeviceStates) Delete

func (n DeviceStates) Delete(stateId int64) (err error)

func (DeviceStates) GetByDeviceId

func (n DeviceStates) GetByDeviceId(deviceId int64) (actions []*DeviceState, err error)

func (DeviceStates) GetById

func (n DeviceStates) GetById(stateId int64) (state *DeviceState, err error)

func (*DeviceStates) List

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

func (DeviceStates) Update

func (n DeviceStates) Update(m *DeviceState) (err error)

type Devices

type Devices struct {
	Db *gorm.DB
}

func (Devices) Add

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

func (Devices) Delete

func (n Devices) Delete(deviceId int64) (err error)

func (*Devices) DependencyLoading

func (n *Devices) DependencyLoading(device *Device) (err error)

func (Devices) GetAllEnabled

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

func (Devices) GetById

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

func (*Devices) List

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

func (*Devices) RemoveAction

func (n *Devices) RemoveAction(deviceId, actionId int64) (err error)

func (*Devices) RemoveState

func (n *Devices) RemoveState(deviceId, stateId int64) (err error)

func (*Devices) Search

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

func (Devices) Update

func (n Devices) Update(m *Device) (err error)

type Flow

type Flow struct {
	Id                 int64 `gorm:"primary_key"`
	Name               string
	Description        string
	Status             StatusType
	Workflow           *Workflow
	WorkflowId         int64
	WorkflowScenarioId int64
	Connections        []*Connection
	FlowElements       []*FlowElement
	Workers            []*Worker
	Subscriptions      []*FlowSubscription
	CreatedAt          time.Time
	UpdatedAt          time.Time
}

func (*Flow) TableName

func (d *Flow) TableName() string

type FlowElement

type FlowElement struct {
	Uuid          uuid.UUID `gorm:"primary_key"`
	Name          string
	Description   string
	Flow          *Flow
	FlowId        int64
	Script        *Script
	ScriptId      *int64
	Status        StatusType
	FlowLink      *int64
	PrototypeType FlowElementsPrototypeType
	GraphSettings json.RawMessage `gorm:"type:jsonb;not null"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (*FlowElement) TableName

func (d *FlowElement) TableName() string

type FlowElements

type FlowElements struct {
	Db *gorm.DB
}

func (FlowElements) Add

func (n FlowElements) Add(flow *FlowElement) (id uuid.UUID, err error)

func (FlowElements) Delete

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

func (FlowElements) GetAllEnabled

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

func (FlowElements) GetById

func (n FlowElements) GetById(id uuid.UUID) (flow *FlowElement, err error)

func (*FlowElements) List

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

func (FlowElements) Update

func (n FlowElements) Update(m *FlowElement) (err error)

type FlowSubscription added in v0.0.21

type FlowSubscription struct {
	Id        int64 `gorm:"primary_key"`
	Flow      *Flow
	FlowId    int64
	Topic     string
	CreatedAt time.Time
}

func (*FlowSubscription) TableName added in v0.0.21

func (d *FlowSubscription) TableName() string

type FlowSubscriptions added in v0.0.21

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

func NewFlowSubscriptions added in v0.0.21

func NewFlowSubscriptions(db *gorm.DB) *FlowSubscriptions

func (*FlowSubscriptions) Add added in v0.0.21

func (f *FlowSubscriptions) Add(sub *FlowSubscription) (err error)

func (*FlowSubscriptions) Delete added in v0.0.21

func (f *FlowSubscriptions) Delete(ids []int64) (err error)

type Flows

type Flows struct {
	Db *gorm.DB
}

func (Flows) Add

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

func (Flows) Delete

func (n Flows) Delete(flowId int64) (err error)

func (*Flows) DependencyLoading

func (n *Flows) DependencyLoading(flow *Flow) (err error)

func (Flows) GetAllEnabled

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

func (Flows) GetAllEnabledByWorkflow

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

func (Flows) GetById

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

func (*Flows) List

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

func (*Flows) Search

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

func (Flows) Update

func (n Flows) Update(m *Flow) (err error)

type Image

type Image struct {
	Id        int64 `gorm:"primary_key"`
	Thumb     string
	Image     string
	MimeType  string
	Title     string
	Size      int64
	Name      string
	CreatedAt time.Time
}

func (*Image) TableName

func (m *Image) TableName() string

type ImageFilterList

type ImageFilterList struct {
	Date  string `json:"date"`
	Count int    `json:"count"`
}

type Images

type Images struct {
	Db *gorm.DB
}

func (Images) Add

func (n Images) Add(v *Image) (id int64, err error)

func (Images) Delete

func (n Images) Delete(mapId int64) (err error)

func (*Images) GetAllByDate

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

func (Images) GetById

func (n Images) GetById(mapId int64) (v *Image, err error)

func (*Images) GetFilterList

func (n *Images) GetFilterList() (images []*ImageFilterList, err error)

func (*Images) List

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

func (Images) Update

func (n Images) Update(m *Image) (err error)

type Log

type Log struct {
	Id        int64 `gorm:"primary_key"`
	Body      string
	Level     common.LogLevel
	CreatedAt time.Time
}

func (*Log) TableName

func (m *Log) TableName() string

type LogQuery

type LogQuery struct {
	StartDate *time.Time `json:"start_date"`
	EndDate   *time.Time `json:"end_date"`
	Levels    []string   `json:"levels"`
}

type Logs

type Logs struct {
	Db *gorm.DB
}

func (Logs) Add

func (n Logs) Add(v *Log) (id int64, err error)

func (Logs) Delete

func (n Logs) Delete(mapId int64) (err error)

func (Logs) GetById

func (n Logs) GetById(mapId int64) (v *Log, err error)

func (*Logs) List

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

func (*Logs) Search

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

type Map

type Map struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Description string
	Options     json.RawMessage `gorm:"type:jsonb;not null"`
	Layers      []*MapLayer
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*Map) TableName

func (d *Map) TableName() string

type MapDevice

type MapDevice struct {
	Id         int64 `gorm:"primary_key"`
	SystemName string
	Image      *Image
	ImageId    int64
	Device     *Device
	DeviceId   int64
	States     []*MapDeviceState
	Actions    []*MapDeviceAction
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

func (*MapDevice) TableName

func (d *MapDevice) TableName() string

type MapDeviceAction

type MapDeviceAction struct {
	Id             int64 `gorm:"primary_key"`
	DeviceAction   *DeviceAction
	DeviceActionId int64
	MapDevice      *MapDevice
	MapDeviceId    int64
	Image          *Image
	ImageId        int64
	Type           string
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

func (*MapDeviceAction) TableName

func (d *MapDeviceAction) TableName() string

type MapDeviceActions

type MapDeviceActions struct {
	Db *gorm.DB
}

func (MapDeviceActions) Add

func (n MapDeviceActions) Add(v *MapDeviceAction) (id int64, err error)

func (MapDeviceActions) Delete

func (n MapDeviceActions) Delete(mapId int64) (err error)

func (MapDeviceActions) GetById

func (n MapDeviceActions) GetById(mapId int64) (v *MapDeviceAction, err error)

func (*MapDeviceActions) List

func (n *MapDeviceActions) List(limit, offset int64, orderBy, sort string) (list []*MapDeviceAction, total int64, err error)

func (MapDeviceActions) Update

func (n MapDeviceActions) Update(m *MapDeviceAction) (err error)

type MapDeviceState

type MapDeviceState struct {
	Id            int64 `gorm:"primary_key"`
	DeviceState   *DeviceState
	DeviceStateId int64
	MapDevice     *MapDevice
	MapDeviceId   int64
	Image         *Image
	ImageId       int64
	Style         string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (*MapDeviceState) TableName

func (d *MapDeviceState) TableName() string

type MapDeviceStates

type MapDeviceStates struct {
	Db *gorm.DB
}

func (MapDeviceStates) Add

func (n MapDeviceStates) Add(v *MapDeviceState) (id int64, err error)

func (MapDeviceStates) Delete

func (n MapDeviceStates) Delete(mapId int64) (err error)

func (MapDeviceStates) GetById

func (n MapDeviceStates) GetById(mapId int64) (v *MapDeviceState, err error)

func (*MapDeviceStates) List

func (n *MapDeviceStates) List(limit, offset int64, orderBy, sort string) (list []*MapDeviceState, total int64, err error)

func (MapDeviceStates) Update

func (n MapDeviceStates) Update(m *MapDeviceState) (err error)

type MapDevices

type MapDevices struct {
	Db *gorm.DB
}

func (MapDevices) Add

func (n MapDevices) Add(v *MapDevice) (id int64, err error)

func (MapDevices) Delete

func (n MapDevices) Delete(id int64) (err error)

func (MapDevices) GetById

func (n MapDevices) GetById(mapId int64) (v *MapDevice, err error)

func (*MapDevices) List

func (n *MapDevices) List(limit, offset int64, orderBy, sort string) (list []*MapDevice, total int64, err error)

func (MapDevices) Update

func (n MapDevices) Update(m *MapDevice) (err error)

type MapElement

type MapElement struct {
	Id            int64 `gorm:"primary_key"`
	Name          string
	Description   string
	PrototypeId   int64
	PrototypeType PrototypeType
	Prototype     Prototype
	Map           *Map
	MapId         int64
	MapLayer      *MapLayer
	MapLayerId    int64
	GraphSettings json.RawMessage `gorm:"type:jsonb;not null"`
	Status        StatusType
	Weight        int64
	ZoneId        *int64
	Zone          *MapZone
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (*MapElement) TableName

func (d *MapElement) TableName() string

type MapElements

type MapElements struct {
	Db *gorm.DB
}

func (MapElements) Add

func (n MapElements) Add(v *MapElement) (id int64, err error)

func (MapElements) Delete

func (n MapElements) Delete(mapId int64) (err error)

func (*MapElements) GetActiveElements added in v0.0.14

func (n *MapElements) GetActiveElements(limit, offset int64, orderBy, sort string) (list []*MapElement, total int64, err error)

func (MapElements) GetById

func (n MapElements) GetById(mapId int64) (v *MapElement, err error)

func (*MapElements) List

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

func (MapElements) Sort

func (n MapElements) Sort(m *MapElement) (err error)

func (MapElements) Update

func (n MapElements) Update(m *MapElement) (err error)

type MapImage

type MapImage struct {
	Id      int64 `gorm:"primary_key"`
	Image   *Image
	ImageId int64
	Style   string
}

func (*MapImage) TableName

func (d *MapImage) TableName() string

type MapImages

type MapImages struct {
	Db *gorm.DB
}

func (MapImages) Add

func (n MapImages) Add(v *MapImage) (id int64, err error)

func (MapImages) Delete

func (n MapImages) Delete(id int64) (err error)

func (MapImages) GetById

func (n MapImages) GetById(mapId int64) (v *MapImage, err error)

func (*MapImages) List

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

func (MapImages) Sort

func (n MapImages) Sort(m *MapImage) (err error)

func (MapImages) Update

func (n MapImages) Update(m *MapImage) (err error)

type MapLayer

type MapLayer struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Description string
	Map         *Map
	MapId       int64
	Status      string
	Weight      int64
	Elements    []*MapElement
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*MapLayer) TableName

func (d *MapLayer) TableName() string

type MapLayers

type MapLayers struct {
	Db *gorm.DB
}

func (MapLayers) Add

func (n MapLayers) Add(v *MapLayer) (id int64, err error)

func (MapLayers) Delete

func (n MapLayers) Delete(mapId int64) (err error)

func (MapLayers) GetById

func (n MapLayers) GetById(mapId int64) (v *MapLayer, err error)

func (*MapLayers) List

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

func (MapLayers) Sort

func (n MapLayers) Sort(m *MapLayer) (err error)

func (MapLayers) Update

func (n MapLayers) Update(m *MapLayer) (err error)

type MapText

type MapText struct {
	Id    int64 `gorm:"primary_key"`
	Text  string
	Style string
}

func (*MapText) TableName

func (d *MapText) TableName() string

type MapTexts

type MapTexts struct {
	Db *gorm.DB
}

func (MapTexts) Add

func (n MapTexts) Add(v *MapText) (id int64, err error)

func (MapTexts) Delete

func (n MapTexts) Delete(id int64) (err error)

func (MapTexts) GetById

func (n MapTexts) GetById(mapId int64) (v *MapText, err error)

func (*MapTexts) List

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

func (MapTexts) Sort

func (n MapTexts) Sort(m *MapText) (err error)

func (MapTexts) Update

func (n MapTexts) Update(m *MapText) (err error)

type MapZone added in v0.0.14

type MapZone struct {
	Id   int64 `gorm:"primary_key"`
	Name string
}

func (*MapZone) TableName added in v0.0.14

func (d *MapZone) TableName() string

type MapZones added in v0.0.14

type MapZones struct {
	Db *gorm.DB
}

func (MapZones) Add added in v0.0.14

func (n MapZones) Add(zone *MapZone) (id int64, err error)

func (MapZones) Clean added in v0.0.14

func (n MapZones) Clean() (err error)

func (MapZones) Delete added in v0.0.14

func (n MapZones) Delete(name string) (err error)

func (MapZones) GetByName added in v0.0.14

func (n MapZones) GetByName(zoneName string) (zone *MapZone, err error)

func (*MapZones) Search added in v0.0.14

func (n *MapZones) Search(query string, limit, offset int) (list []*MapZone, total int64, err error)

type Maps

type Maps struct {
	Db *gorm.DB
}

func (Maps) Add

func (n Maps) Add(v *Map) (id int64, err error)

func (Maps) Delete

func (n Maps) Delete(mapId int64) (err error)

func (Maps) GetById

func (n Maps) GetById(mapId int64) (v *Map, err error)

func (Maps) GetFullById

func (n Maps) GetFullById(mapId int64) (v *Map, err error)

func (*Maps) List

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

func (*Maps) Search

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

func (Maps) Update

func (n Maps) Update(m *Map) (err error)

type Message added in v0.0.17

type Message struct {
	Id           int64 `gorm:"primary_key"`
	Type         string
	EmailFrom    *string
	EmailSubject *string
	EmailBody    *string
	SmsText      *string
	SlackText    *string
	UiText       *string
	TelegramText *string
	Statuses     []*MessageDelivery
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

func (*Message) TableName added in v0.0.17

func (d *Message) TableName() string

type MessageDeliveries added in v0.0.17

type MessageDeliveries struct {
	Db *gorm.DB
}

func (MessageDeliveries) Add added in v0.0.17

func (n MessageDeliveries) Add(msg *MessageDelivery) (id int64, err error)

func (MessageDeliveries) Delete added in v0.0.17

func (n MessageDeliveries) Delete(id int64) (err error)

func (*MessageDeliveries) GetAllUncompleted added in v0.0.17

func (n *MessageDeliveries) GetAllUncompleted(limit, offset int64) (list []*MessageDelivery, total int64, err error)

func (MessageDeliveries) GetById added in v0.0.17

func (n MessageDeliveries) GetById(id int64) (msg *MessageDelivery, err error)

func (*MessageDeliveries) List added in v0.0.17

func (n *MessageDeliveries) List(limit, offset int64, orderBy, sort string) (list []*MessageDelivery, total int64, err error)

func (MessageDeliveries) SetStatus added in v0.0.17

func (n MessageDeliveries) SetStatus(msg *MessageDelivery) (err error)

type MessageDelivery added in v0.0.17

type MessageDelivery struct {
	Id                 int64 `gorm:"primary_key"`
	Message            *Message
	MessageId          int64
	Address            string
	Status             string
	ErrorMessageStatus *string `gorm:"column:error_system_code"`
	ErrorMessageBody   *string `gorm:"column:error_system_message"`
	CreatedAt          time.Time
	UpdatedAt          time.Time
}

func (*MessageDelivery) TableName added in v0.0.17

func (d *MessageDelivery) TableName() string

type Messages added in v0.0.17

type Messages struct {
	Db *gorm.DB
}

func (Messages) Add added in v0.0.17

func (n Messages) Add(msg *Message) (id int64, err error)

type Node

type Node struct {
	Id                int64 `gorm:"primary_key"`
	Name              string
	Status            string
	Description       string
	Login             string
	EncryptedPassword string
	CreatedAt         time.Time
	UpdatedAt         time.Time
}

func (*Node) TableName

func (d *Node) TableName() string

type Nodes

type Nodes struct {
	Db *gorm.DB
}

func (Nodes) Add

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

func (Nodes) Delete

func (n Nodes) Delete(nodeId int64) (err error)

func (Nodes) GetAllEnabled

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

func (Nodes) GetById

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

func (*Nodes) GetByLogin

func (n *Nodes) GetByLogin(login string) (node *Node, err error)

func (*Nodes) List

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

func (*Nodes) Search

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

func (Nodes) Update

func (n Nodes) Update(m *Node) (err error)

type Permission

type Permission struct {
	Id          int64 `gorm:"primary_key"`
	Role        *Role `gorm:"foreignkey:RoleName"`
	RoleName    string
	PackageName string
	LevelName   string
}

func (*Permission) TableName

func (m *Permission) TableName() string

type Permissions

type Permissions struct {
	Db *gorm.DB
}

func (Permissions) Add

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

func (Permissions) Delete

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

func (Permissions) GetAllPermissions

func (n Permissions) GetAllPermissions(name string) (permissions []*Permission, err error)

type Prototype

type Prototype struct {
	*MapImage
	*MapText
	*MapDevice
}

type Role

type Role struct {
	Name        string `gorm:"primary_key"`
	Description string
	Role        *Role
	RoleName    sql.NullString `gorm:"column:parent"`
	Children    []*Role
	Permissions []*Permission
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*Role) TableName

func (m *Role) TableName() string

type Roles

type Roles struct {
	Db *gorm.DB
}

func (Roles) Add

func (n Roles) Add(role *Role) (err error)

func (Roles) Delete

func (n Roles) Delete(name string) (err error)

func (Roles) GetByName

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

func (*Roles) List

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

func (*Roles) RelData

func (n *Roles) RelData(role *Role) (err error)

func (*Roles) Search

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

func (Roles) Update

func (n Roles) Update(m *Role) (err error)

type Script

type Script struct {
	Id          int64 `gorm:"primary_key"`
	Lang        ScriptLang
	Name        string
	Source      string
	Description string
	Compiled    string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*Script) TableName

func (d *Script) TableName() string

type Scripts

type Scripts struct {
	Db *gorm.DB
}

func (Scripts) Add

func (n Scripts) Add(node *Script) (id int64, err error)

func (Scripts) Delete

func (n Scripts) Delete(nodeId int64) (err error)

func (Scripts) GetById

func (n Scripts) GetById(nodeId int64) (node *Script, err error)

func (*Scripts) List

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

func (*Scripts) Search

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

func (Scripts) Update

func (n Scripts) Update(m *Script) (err error)

type Template added in v0.0.17

type Template struct {
	Name        string `gorm:"primary_key"`
	Description string
	Content     string
	Status      string
	Type        string
	ParentName  *string `gorm:"column:parent"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*Template) TableName added in v0.0.17

func (d *Template) TableName() string

type TemplateTree added in v0.0.17

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

type Templates added in v0.0.17

type Templates struct {
	Db *gorm.DB
}

func (Templates) Create added in v0.0.17

func (n Templates) Create(tpl *Template) error

func (Templates) Delete added in v0.0.17

func (n Templates) Delete(name string) (err error)

func (Templates) GetByName added in v0.0.17

func (n Templates) GetByName(name, itemType string) (*Template, error)

func (Templates) GetItemsSortedList added in v0.0.17

func (n Templates) GetItemsSortedList() (count int64, newItems []string, err error)

func (Templates) GetItemsTree added in v0.0.17

func (n Templates) GetItemsTree() (tree []*TemplateTree, err error)

func (Templates) GetList added in v0.0.17

func (n Templates) GetList(templateType string) ([]*Template, error)

func (*Templates) Search added in v0.0.17

func (n *Templates) Search(query string, limit, offset int) (items []*Template, total int64, err error)

func (Templates) Update added in v0.0.17

func (n Templates) Update(m *Template) error

func (Templates) UpdateItemsTree added in v0.0.17

func (n Templates) UpdateItemsTree(tree []*TemplateTree, parent string) error

func (Templates) UpdateOrCreate added in v0.0.17

func (n Templates) UpdateOrCreate(tpl *Template) error

func (Templates) UpdateStatus added in v0.0.17

func (n Templates) UpdateStatus(m *Template) error

type User

type User struct {
	Id                  int64 `gorm:"primary_key"`
	Nickname            string
	FirstName           string
	LastName            string
	EncryptedPassword   string
	Email               string
	Status              string
	ResetPasswordToken  string
	AuthenticationToken *string
	Image               *Image
	ImageId             sql.NullInt64
	SignInCount         int64
	CurrentSignInIp     string
	LastSignInIp        string
	Lang                string
	User                *User
	UserId              sql.NullInt64
	Role                *Role
	RoleName            string
	Meta                []*UserMeta
	ResetPasswordSentAt *time.Time
	CurrentSignInAt     *time.Time
	LastSignInAt        *time.Time
	CreatedAt           time.Time
	UpdatedAt           time.Time
	DeletedAt           *time.Time
	History             json.RawMessage `gorm:"type:jsonb;not null"`
}

func (*User) TableName

func (u *User) TableName() string

type UserMeta

type UserMeta struct {
	Id     int64 `gorm:"primary_key"`
	UserId int64
	Key    string
	Value  string
}

func (*UserMeta) TableName

func (m *UserMeta) TableName() string

type UserMetas

type UserMetas struct {
	Db *gorm.DB
}

func (*UserMetas) UpdateOrCreate

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

type Users

type Users struct {
	Db *gorm.DB
}

func (*Users) Add

func (u *Users) Add(user *User) (id int64, err error)

func (*Users) ClearResetPassToken

func (u *Users) ClearResetPassToken(userId int64) (err error)

func (*Users) ClearToken

func (u *Users) ClearToken(userId int64) (err error)

func (*Users) Delete

func (u *Users) Delete(userId int64) (err error)

func (*Users) GetByAuthenticationToken

func (u *Users) GetByAuthenticationToken(token string) (user *User, err error)

func (*Users) GetByEmail

func (u *Users) GetByEmail(email string) (user *User, err error)

func (*Users) GetById

func (u *Users) GetById(userId int64) (user *User, err error)

func (*Users) GetByResetPassToken

func (u *Users) GetByResetPassToken(token string) (user *User, err error)

func (*Users) List

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

func (*Users) NewResetPassToken

func (u *Users) NewResetPassToken(userId int64, token string) (err error)

func (*Users) Update

func (u *Users) Update(user *User) (err error)

func (*Users) UpdateAuthenticationToken

func (u *Users) UpdateAuthenticationToken(userId int64, token string) (err error)

type Variable

type Variable struct {
	Name      string `gorm:"primary_key"`
	Value     string
	Autoload  bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Variable) TableName

func (d *Variable) TableName() string

type Variables

type Variables struct {
	Db *gorm.DB
}

func (Variables) Add

func (n Variables) Add(variable *Variable) (err error)

func (Variables) Delete

func (n Variables) Delete(name string) (err error)

func (Variables) GetAllEnabled

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

func (Variables) GetByName

func (n Variables) GetByName(name string) (variable *Variable, err error)

func (*Variables) List

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

func (Variables) Update

func (n Variables) Update(m *Variable) (err error)

type Worker

type Worker struct {
	Id             int64 `gorm:"primary_key"`
	Workflow       *Workflow
	WorkflowId     int64
	DeviceAction   *DeviceAction
	DeviceActionId int64
	Flow           *Flow
	FlowId         int64
	Status         string
	Name           string
	Time           string
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

func (*Worker) TableName

func (m *Worker) TableName() string

type Workers

type Workers struct {
	Db *gorm.DB
}

func (Workers) Add

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

func (Workers) Delete

func (n Workers) Delete(ids []int64) (err error)

func (Workers) GetAllEnabled

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

func (Workers) GetById

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

func (*Workers) List

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

func (Workers) Update

func (n Workers) Update(m *Worker) (err error)

type Workflow

type Workflow struct {
	Id                 int64 `gorm:"primary_key"`
	Name               string
	Description        string
	Status             string
	WorkflowScenarioId *int64
	WorkflowScenario   *WorkflowScenario
	Scenarios          []*WorkflowScenario
	Scripts            []*Script
	CreatedAt          time.Time
	UpdatedAt          time.Time
}

func (*Workflow) TableName

func (d *Workflow) TableName() string

type WorkflowScenario

type WorkflowScenario struct {
	Id         int64 `gorm:"primary_key"`
	Name       string
	SystemName string
	WorkflowId int64
	Scripts    []*Script
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

func (*WorkflowScenario) TableName

func (d *WorkflowScenario) TableName() string

type WorkflowScenarioScript

type WorkflowScenarioScript struct {
	Id                 int64 `gorm:"primary_key"`
	ScriptId           int64
	WorkflowScenarioId int64
}

func (*WorkflowScenarioScript) TableName

func (d *WorkflowScenarioScript) TableName() string

type WorkflowScenarioScripts

type WorkflowScenarioScripts struct {
	Db *gorm.DB
}

func (WorkflowScenarioScripts) Add

func (n WorkflowScenarioScripts) Add(scenario *WorkflowScenarioScript) (id int64, err error)

func (WorkflowScenarioScripts) Delete

func (n WorkflowScenarioScripts) Delete(workflowId int64) (err error)

func (*WorkflowScenarioScripts) List

func (n *WorkflowScenarioScripts) List(limit, offset int64, orderBy, sort string) (list []*WorkflowScenarioScript, total int64, err error)

type WorkflowScenarios

type WorkflowScenarios struct {
	Db *gorm.DB
}

func (WorkflowScenarios) Add

func (n WorkflowScenarios) Add(scenario *WorkflowScenario) (id int64, err error)

func (*WorkflowScenarios) AddScript

func (n *WorkflowScenarios) AddScript(workflowScenarioId, scriptId int64) (err error)

func (WorkflowScenarios) Delete

func (n WorkflowScenarios) Delete(workflowId int64) (err error)

func (*WorkflowScenarios) DependencyLoading

func (n *WorkflowScenarios) DependencyLoading(scenario *WorkflowScenario) (err error)

func (WorkflowScenarios) GetById

func (n WorkflowScenarios) GetById(scenarioId int64) (scenario *WorkflowScenario, err error)

func (*WorkflowScenarios) List

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

func (*WorkflowScenarios) ListByWorkflow

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

func (*WorkflowScenarios) RemoveScript

func (n *WorkflowScenarios) RemoveScript(workflowScenarioId, scriptId int64) (err error)

func (*WorkflowScenarios) Search

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

func (WorkflowScenarios) Update

func (n WorkflowScenarios) Update(m *WorkflowScenario) (err error)

type WorkflowScripts

type WorkflowScripts struct {
	Id         int64 `gorm:"primary_key"`
	Workflow   *Workflow
	WorkflowId int64
	Script     *Script
	ScriptId   int64
	Weight     int64
}

func (*WorkflowScripts) TableName

func (d *WorkflowScripts) TableName() string

type Workflows

type Workflows struct {
	Db *gorm.DB
}

func (Workflows) Add

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

func (*Workflows) AddScript

func (n *Workflows) AddScript(workflowId, scriptId int64) (err error)

func (Workflows) Delete

func (n Workflows) Delete(workflowId int64) (err error)

func (*Workflows) DependencyLoading

func (n *Workflows) DependencyLoading(workflow *Workflow) (err error)

func (Workflows) GetAllEnabled

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

func (Workflows) GetById

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

func (*Workflows) List

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

func (*Workflows) RemoveScript

func (n *Workflows) RemoveScript(workflowId, scriptId int64) (err error)

func (*Workflows) Search

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

func (*Workflows) SetScenario

func (n *Workflows) SetScenario(workflowId int64, scenarioId *int64) (err error)

func (Workflows) Update

func (n Workflows) Update(m *Workflow) (err error)

Jump to

Keyboard shortcuts

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