db

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v0.5.0

type Action struct {
	Id               int64 `gorm:"primary_key"`
	Name             string
	Script           *Script
	ScriptId         *int64
	Entity           *Entity
	EntityId         *common.EntityId
	EntityActionName *string
	AreaId           *int64
	Area             *Area
	Description      string
	CreatedAt        time.Time `gorm:"<-:create"`
	UpdatedAt        time.Time
}

Action ...

func (*Action) TableName added in v0.5.0

func (*Action) TableName() string

TableName ...

type Actions added in v0.5.0

type Actions struct {
	Db *gorm.DB
}

Actions ...

func (Actions) Add added in v0.12.0

func (t Actions) Add(ctx context.Context, action *Action) (id int64, err error)

Add ...

func (Actions) Delete added in v0.12.0

func (t Actions) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (Actions) GetById added in v0.12.0

func (t Actions) GetById(ctx context.Context, id int64) (action *Action, err error)

GetById ...

func (*Actions) List added in v0.12.0

func (t *Actions) List(ctx context.Context, limit, offset int, orderBy, sort string, ids *[]uint64) (list []*Action, total int64, err error)

List ...

func (*Actions) Search added in v0.12.0

func (t *Actions) Search(ctx context.Context, query string, limit, offset int) (list []*Action, total int64, err error)

Search ...q

func (Actions) Update added in v0.12.0

func (t Actions) Update(ctx context.Context, m *Action) (err error)

Update ...

type AlexaIntent added in v0.3.0

type AlexaIntent struct {
	Name         string `gorm:"primary_key"`
	AlexaSkill   *AlexaSkill
	AlexaSkillId int64
	Script       *Script
	ScriptId     int64
	Description  string
	CreatedAt    time.Time `gorm:"<-:create"`
	UpdatedAt    time.Time
}

AlexaIntent ...

func (*AlexaIntent) TableName added in v0.3.0

func (d *AlexaIntent) TableName() string

TableName ...

type AlexaIntents added in v0.3.0

type AlexaIntents struct {
	Db *gorm.DB
}

AlexaIntents ...

func (AlexaIntents) Add added in v0.3.0

func (n AlexaIntents) Add(ctx context.Context, v *AlexaIntent) (err error)

Add ...

func (AlexaIntents) Delete added in v0.3.0

func (n AlexaIntents) Delete(ctx context.Context, v *AlexaIntent) (err error)

Delete ...

func (AlexaIntents) GetByName added in v0.3.0

func (n AlexaIntents) GetByName(ctx context.Context, name string) (intent *AlexaIntent, err error)

GetByName ...

func (AlexaIntents) Update added in v0.3.0

func (n AlexaIntents) Update(ctx context.Context, v *AlexaIntent) (err error)

Update ...

type AlexaSkill added in v0.3.0

type AlexaSkill struct {
	Id          int64 `gorm:"primary_key"`
	SkillId     string
	Description string
	Intents     []*AlexaIntent `gorm:"foreignkey:AlexaSkillId"`
	Status      common.StatusType
	Script      *Script
	ScriptId    *int64
	CreatedAt   time.Time `gorm:"<-:create"`
	UpdatedAt   time.Time
}

AlexaSkill ...

func (*AlexaSkill) TableName added in v0.3.0

func (d *AlexaSkill) TableName() string

TableName ...

type AlexaSkills added in v0.3.0

type AlexaSkills struct {
	Db *gorm.DB
}

AlexaSkills ...

func (AlexaSkills) Add added in v0.3.0

func (n AlexaSkills) Add(ctx context.Context, v *AlexaSkill) (id int64, err error)

Add ...

func (AlexaSkills) Delete added in v0.3.0

func (n AlexaSkills) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (AlexaSkills) GetById added in v0.3.0

func (n AlexaSkills) GetById(ctx context.Context, id int64) (v *AlexaSkill, err error)

GetById ...

func (*AlexaSkills) List added in v0.3.0

func (n *AlexaSkills) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*AlexaSkill, total int64, err error)

List ...

func (*AlexaSkills) ListEnabled added in v0.3.0

func (n *AlexaSkills) ListEnabled(ctx context.Context, limit, offset int) (list []*AlexaSkill, err error)

ListEnabled ...

func (AlexaSkills) Update added in v0.3.0

func (n AlexaSkills) Update(ctx context.Context, v *AlexaSkill) (err error)

Update ...

type Area added in v0.5.0

type Area struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Description string
	Polygon     *Polygon
	Payload     json.RawMessage `gorm:"type:jsonb;not null"`
	CreatedAt   time.Time       `gorm:"<-:create"`
	UpdatedAt   time.Time
}

Area ...

func (*Area) TableName added in v0.5.0

func (d *Area) TableName() string

TableName ...

type Areas added in v0.5.0

type Areas struct {
	Db *gorm.DB
}

Areas ...

func (*Areas) Add added in v0.5.0

func (n *Areas) Add(ctx context.Context, area *Area) (id int64, err error)

Add ...

func (*Areas) Clean added in v0.5.0

func (n *Areas) Clean(ctx context.Context) (err error)

Clean ...

func (*Areas) DeleteByName added in v0.5.0

func (n *Areas) DeleteByName(ctx context.Context, name string) (err error)

DeleteByName ...

func (*Areas) GetById added in v0.5.0

func (n *Areas) GetById(ctx context.Context, areaId int64) (area *Area, err error)

GetById ...

func (*Areas) GetByName added in v0.5.0

func (n *Areas) GetByName(ctx context.Context, name string) (area *Area, err error)

GetByName ...

func (*Areas) List added in v0.5.0

func (n *Areas) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*Area, total int64, err error)

List ...

func (*Areas) Search added in v0.5.0

func (n *Areas) Search(ctx context.Context, query string, limit, offset int) (list []*Area, total int64, err error)

Search ...

func (*Areas) Update added in v0.5.0

func (n *Areas) Update(ctx context.Context, area *Area) (err error)

Update ...

type Condition added in v0.5.0

type Condition struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Script      *Script
	ScriptId    *int64
	AreaId      *int64
	Area        *Area
	Description string
	CreatedAt   time.Time `gorm:"<-:create"`
	UpdatedAt   time.Time
}

Condition ...

func (*Condition) TableName added in v0.5.0

func (d *Condition) TableName() string

TableName ...

type Conditions added in v0.5.0

type Conditions struct {
	Db *gorm.DB
}

Conditions ...

func (Conditions) Add added in v0.12.0

func (t Conditions) Add(ctx context.Context, condition *Condition) (id int64, err error)

Add ...

func (Conditions) Delete added in v0.12.0

func (t Conditions) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (Conditions) GetById added in v0.12.0

func (t Conditions) GetById(ctx context.Context, id int64) (condition *Condition, err error)

GetById ...

func (*Conditions) List added in v0.12.0

func (t *Conditions) List(ctx context.Context, limit, offset int, orderBy, sort string, ids *[]uint64) (list []*Condition, total int64, err error)

List ...

func (*Conditions) Search added in v0.12.0

func (t *Conditions) Search(ctx context.Context, query string, limit, offset int) (list []*Condition, total int64, err error)

Search ...q

func (Conditions) Update added in v0.12.0

func (t Conditions) Update(ctx context.Context, m *Condition) (err error)

Update ...

type Dashboard added in v0.6.0

type Dashboard struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Description string
	Enabled     bool
	AreaId      *int64
	Area        *Area
	Tabs        []*DashboardTab
	CreatedAt   time.Time `gorm:"<-:create"`
	UpdatedAt   time.Time
}

Dashboard ...

func (*Dashboard) TableName added in v0.6.0

func (d *Dashboard) TableName() string

TableName ...

type DashboardCard added in v0.6.0

type DashboardCard struct {
	Id             int64 `gorm:"primary_key"`
	Title          string
	Weight         int
	Width          int
	Height         int
	Background     *string
	Enabled        bool
	DashboardTabId int64
	DashboardTab   *DashboardTab
	Items          []*DashboardCardItem
	Payload        json.RawMessage `gorm:"type:jsonb;not null"`
	EntityId       *common.EntityId
	Hidden         bool
	CreatedAt      time.Time `gorm:"<-:create"`
	UpdatedAt      time.Time
}

DashboardCard ...

func (*DashboardCard) TableName added in v0.6.0

func (d *DashboardCard) TableName() string

TableName ...

type DashboardCardItem added in v0.6.0

type DashboardCardItem struct {
	Id              int64 `gorm:"primary_key"`
	Title           string
	Type            string
	Weight          int
	Enabled         bool
	DashboardCardId int64
	DashboardCard   *DashboardCard
	EntityId        *common.EntityId
	Payload         json.RawMessage `gorm:"type:jsonb;not null"`
	Hidden          bool
	Frozen          bool
	CreatedAt       time.Time `gorm:"<-:create"`
	UpdatedAt       time.Time
}

DashboardCardItem ...

func (*DashboardCardItem) TableName added in v0.6.0

func (d *DashboardCardItem) TableName() string

TableName ...

type DashboardCardItems added in v0.6.0

type DashboardCardItems struct {
	Db *gorm.DB
}

DashboardCardItems ...

func (DashboardCardItems) Add added in v0.6.0

func (n DashboardCardItems) Add(ctx context.Context, item *DashboardCardItem) (id int64, err error)

Add ...

func (DashboardCardItems) Delete added in v0.6.0

func (n DashboardCardItems) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (DashboardCardItems) GetById added in v0.6.0

func (n DashboardCardItems) GetById(ctx context.Context, id int64) (item *DashboardCardItem, err error)

GetById ...

func (*DashboardCardItems) List added in v0.6.0

func (n *DashboardCardItems) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*DashboardCardItem, total int64, err error)

List ...

func (DashboardCardItems) Update added in v0.6.0

func (n DashboardCardItems) Update(ctx context.Context, m *DashboardCardItem) (err error)

Update ...

type DashboardCards added in v0.6.0

type DashboardCards struct {
	Db *gorm.DB
}

DashboardCards ...

func (DashboardCards) Add added in v0.6.0

func (n DashboardCards) Add(ctx context.Context, card *DashboardCard) (id int64, err error)

Add ...

func (DashboardCards) Delete added in v0.6.0

func (n DashboardCards) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (DashboardCards) GetById added in v0.6.0

func (n DashboardCards) GetById(ctx context.Context, id int64) (card *DashboardCard, err error)

GetById ...

func (*DashboardCards) List added in v0.6.0

func (n *DashboardCards) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*DashboardCard, total int64, err error)

List ...

func (DashboardCards) Update added in v0.6.0

func (n DashboardCards) Update(ctx context.Context, m *DashboardCard) (err error)

Update ...

type DashboardTab added in v0.6.0

type DashboardTab struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Icon        string
	Enabled     bool
	Weight      int
	ColumnWidth int
	Gap         bool
	Background  *string
	DashboardId int64
	Dashboard   *Dashboard
	Cards       []*DashboardCard
	Payload     json.RawMessage `gorm:"type:jsonb;not null"`
	CreatedAt   time.Time       `gorm:"<-:create"`
	UpdatedAt   time.Time
}

DashboardTab ...

func (*DashboardTab) TableName added in v0.6.0

func (d *DashboardTab) TableName() string

TableName ...

type DashboardTabs added in v0.6.0

type DashboardTabs struct {
	Db *gorm.DB
}

DashboardTabs ...

func (DashboardTabs) Add added in v0.6.0

func (n DashboardTabs) Add(ctx context.Context, tab *DashboardTab) (id int64, err error)

Add ...

func (DashboardTabs) Delete added in v0.6.0

func (n DashboardTabs) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (DashboardTabs) GetById added in v0.6.0

func (n DashboardTabs) GetById(ctx context.Context, id int64) (tab *DashboardTab, err error)

GetById ...

func (*DashboardTabs) List added in v0.6.0

func (n *DashboardTabs) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*DashboardTab, total int64, err error)

List ...

func (DashboardTabs) Update added in v0.6.0

func (n DashboardTabs) Update(ctx context.Context, tab *DashboardTab) (err error)

Update ...

type Dashboards added in v0.6.0

type Dashboards struct {
	Db *gorm.DB
}

Dashboards ...

func (Dashboards) Add added in v0.6.0

func (n Dashboards) Add(ctx context.Context, board *Dashboard) (id int64, err error)

Add ...

func (Dashboards) Delete added in v0.6.0

func (n Dashboards) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (Dashboards) GetById added in v0.6.0

func (n Dashboards) GetById(ctx context.Context, id int64) (board *Dashboard, err error)

GetById ...

func (*Dashboards) List added in v0.6.0

func (n *Dashboards) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*Dashboard, total int64, err error)

List ...

func (*Dashboards) Search added in v0.7.0

func (d *Dashboards) Search(ctx context.Context, query string, limit, offset int) (list []*Dashboard, total int64, err error)

Search ...

func (Dashboards) Update added in v0.6.0

func (n Dashboards) Update(ctx context.Context, board *Dashboard) (err error)

Update ...

type Entities added in v0.5.0

type Entities struct {
	Db *gorm.DB
}

Entities ...

func (Entities) Add added in v0.5.0

func (n Entities) Add(ctx context.Context, v *Entity) (err error)

Add ...

func (Entities) Delete added in v0.5.0

func (n Entities) Delete(ctx context.Context, id common.EntityId) (err error)

Delete ...

func (Entities) DeleteScripts added in v0.12.0

func (n Entities) DeleteScripts(ctx context.Context, id common.EntityId) (err error)

DeleteScripts ...

func (Entities) DeleteTags added in v0.17.0

func (n Entities) DeleteTags(ctx context.Context, id common.EntityId) (err error)

DeleteTags ...

func (Entities) GetById added in v0.5.0

func (n Entities) GetById(ctx context.Context, id common.EntityId) (v *Entity, err error)

GetById ...

func (Entities) GetByIds added in v0.6.0

func (n Entities) GetByIds(ctx context.Context, ids []common.EntityId) (list []*Entity, err error)

GetByIds ...

func (Entities) GetByIdsSimple added in v0.12.0

func (n Entities) GetByIdsSimple(ctx context.Context, ids []common.EntityId) (list []*Entity, err error)

GetByIdsSimple ...

func (*Entities) GetByType added in v0.5.0

func (n *Entities) GetByType(ctx context.Context, t string, limit, offset int) (list []*Entity, err error)

GetByType ...

func (*Entities) List added in v0.5.0

func (n *Entities) List(ctx context.Context, limit, offset int, orderBy, sort string, autoLoad bool,
	query, plugin *string, areaId *int64) (list []*Entity, total int64, err error)

List ...

func (*Entities) ListPlain added in v0.14.0

func (n *Entities) ListPlain(ctx context.Context, limit, offset int, orderBy, sort string, autoLoad bool,
	query, plugin *string, areaId *int64, tags *[]string) (list []*Entity, total int64, err error)

ListPlain ...

func (Entities) PreloadStorage added in v0.13.0

func (n Entities) PreloadStorage(ctx context.Context, list []*Entity) (err error)

PreloadStorage ...

func (*Entities) Search added in v0.5.0

func (n *Entities) Search(ctx context.Context, query string, limit, offset int) (list []*Entity, total int64, err error)

Search ...

func (*Entities) Statistic added in v0.17.0

func (n *Entities) Statistic(ctx context.Context) (statistic *EntitiesStatistic, err error)

Statistic ...

func (Entities) Update added in v0.5.0

func (n Entities) Update(ctx context.Context, v *Entity) (err error)

Update ...

func (Entities) UpdateAutoload added in v0.12.0

func (n Entities) UpdateAutoload(ctx context.Context, entityId common.EntityId, autoLoad bool) (err error)

UpdateAutoload ...

type EntitiesStatistic added in v0.17.0

type EntitiesStatistic struct {
	Total  int32
	Used   int32
	Unused int32
}

type Entity added in v0.5.0

type Entity struct {
	Id           common.EntityId `gorm:"primary_key"`
	Description  string
	PluginName   string
	Image        *Image
	ImageId      *int64
	States       []*EntityState
	Actions      []*EntityAction
	AreaId       *int64
	Area         *Area
	Metrics      []*Metric `gorm:"many2many:entity_metrics;"`
	Scripts      []*Script `gorm:"many2many:entity_scripts;"`
	Tags         []*Tag    `gorm:"many2many:entity_tags;"`
	Icon         *string
	Payload      json.RawMessage `gorm:"type:jsonb;not null"`
	Settings     json.RawMessage `gorm:"type:jsonb;not null"`
	Storage      []*EntityStorage
	AutoLoad     bool
	RestoreState bool
	ParentId     *common.EntityId `gorm:"column:parent_id"`
	CreatedAt    time.Time        `gorm:"<-:create"`
	UpdatedAt    time.Time
}

Entity ...

func (*Entity) TableName added in v0.5.0

func (d *Entity) TableName() string

TableName ...

type EntityAction added in v0.5.0

type EntityAction struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Description string
	Icon        *string
	Entity      *Entity
	EntityId    common.EntityId
	Image       *Image
	ImageId     *int64
	Script      *Script
	ScriptId    *int64
	Type        string
	CreatedAt   time.Time `gorm:"<-:create"`
	UpdatedAt   time.Time
}

EntityAction ...

func (*EntityAction) TableName added in v0.5.0

func (d *EntityAction) TableName() string

TableName ...

type EntityActions added in v0.5.0

type EntityActions struct {
	Db *gorm.DB
}

EntityActions ...

func (EntityActions) Add added in v0.5.0

func (n EntityActions) Add(ctx context.Context, v *EntityAction) (id int64, err error)

Add ...

func (*EntityActions) AddMultiple added in v0.12.0

func (n *EntityActions) AddMultiple(ctx context.Context, actions []*EntityAction) (err error)

AddMultiple ...

func (EntityActions) DeleteByEntityId added in v0.5.0

func (n EntityActions) DeleteByEntityId(ctx context.Context, deviceId common.EntityId) (err error)

DeleteByEntityId ...

func (EntityActions) GetById added in v0.5.0

func (n EntityActions) GetById(ctx context.Context, id int64) (v *EntityAction, err error)

GetById ...

func (*EntityActions) List added in v0.5.0

func (n *EntityActions) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*EntityAction, total int64, err error)

List ...

func (EntityActions) Update added in v0.5.0

func (n EntityActions) Update(ctx context.Context, m *EntityAction) (err error)

Update ...

type EntityMetric added in v0.5.0

type EntityMetric struct {
	Entity   *Entity
	EntityId string `gorm:"primary_key;auto_increment:false"`
	Metric   *Metric
	MetricId int64 `gorm:"primary_key;auto_increment:false"`
}

EntityMetric ...

func (EntityMetric) TableName added in v0.5.0

func (EntityMetric) TableName() string

TableName ...

type EntityScript added in v0.5.0

type EntityScript struct {
	Id       int64  `gorm:"primary_key"`
	EntityId string `gorm:"primary_key;auto_increment:false"`
	Entity   *Entity
	ScriptId int64 `gorm:"primary_key;auto_increment:false"`
	Script   *Script
	Weight   int
}

EntityScript ...

func (*EntityScript) TableName added in v0.5.0

func (d *EntityScript) TableName() string

TableName ...

type EntityScripts added in v0.5.0

type EntityScripts struct {
}

EntityScripts ...

type EntityState added in v0.5.0

type EntityState struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Description string
	Icon        *string
	Entity      *Entity
	EntityId    common.EntityId
	Image       *Image
	ImageId     *int64
	Style       string
	CreatedAt   time.Time `gorm:"<-:create"`
	UpdatedAt   time.Time
}

EntityState ...

func (*EntityState) TableName added in v0.5.0

func (d *EntityState) TableName() string

TableName ...

type EntityStates added in v0.5.0

type EntityStates struct {
	Db *gorm.DB
}

EntityStates ...

func (EntityStates) Add added in v0.5.0

func (n EntityStates) Add(ctx context.Context, v *EntityState) (id int64, err error)

Add ...

func (*EntityStates) AddMultiple added in v0.12.0

func (n *EntityStates) AddMultiple(ctx context.Context, states []*EntityState) (err error)

AddMultiple ...

func (EntityStates) DeleteByEntityId added in v0.5.0

func (n EntityStates) DeleteByEntityId(ctx context.Context, entityId common.EntityId) (err error)

DeleteByEntityId ...

func (EntityStates) GetById added in v0.5.0

func (n EntityStates) GetById(ctx context.Context, id int64) (v *EntityState, err error)

GetById ...

func (*EntityStates) List added in v0.5.0

func (n *EntityStates) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*EntityState, total int64, err error)

List ...

func (EntityStates) Update added in v0.5.0

func (n EntityStates) Update(ctx context.Context, m *EntityState) (err error)

Update ...

type EntityStorage added in v0.5.0

type EntityStorage struct {
	Id         int64 `gorm:"primary_key"`
	EntityId   common.EntityId
	State      string
	Attributes json.RawMessage `gorm:"type:jsonb;not null"`
	CreatedAt  time.Time       `gorm:"<-:create"`
}

EntityStorage ...

func (*EntityStorage) TableName added in v0.5.0

func (d *EntityStorage) TableName() string

TableName ...

type EntityStorages added in v0.5.0

type EntityStorages struct {
	Db *gorm.DB
}

EntityStorages ...

func (*EntityStorages) Add added in v0.5.0

func (n *EntityStorages) Add(ctx context.Context, v *EntityStorage) (id int64, err error)

Add ...

func (*EntityStorages) DeleteOldest added in v0.9.4

func (n *EntityStorages) DeleteOldest(ctx context.Context, days int) (err error)

DeleteOldest ...

func (*EntityStorages) GetLastByEntityId added in v0.5.0

func (n *EntityStorages) GetLastByEntityId(ctx context.Context, entityId common.EntityId) (v *EntityStorage, err error)

GetLastByEntityId ...

func (*EntityStorages) List added in v0.5.0

func (n *EntityStorages) List(ctx context.Context, limit, offset int, orderBy, sort string, entityIds []common.EntityId, startDate, endDate *time.Time) (list []*EntityStorage, total int64, err error)

List ...

type EntityTag added in v0.17.0

type EntityTag struct {
	EntityId string `gorm:"primary_key;auto_increment:false"`
	TagName  string `gorm:"primary_key;auto_increment:false"`
}

EntityTag ...

func (*EntityTag) TableName added in v0.17.0

func (d *EntityTag) TableName() string

TableName ...

type EntityTags added in v0.17.0

type EntityTags struct {
}

EntityTags ...

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 `gorm:"<-:create"`
}

Image ...

func (*Image) TableName

func (m *Image) TableName() string

TableName ...

type ImageFilterList

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

ImageFilterList ...

type Images

type Images struct {
	Db *gorm.DB
}

Images ...

func (Images) Add

func (n Images) Add(ctx context.Context, v *Image) (id int64, err error)

Add ...

func (*Images) AddMultiple added in v0.12.0

func (n *Images) AddMultiple(ctx context.Context, images []*Image) (err error)

AddMultiple ...

func (Images) Delete

func (n Images) Delete(ctx context.Context, mapId int64) (err error)

Delete ...

func (*Images) GetAllByDate

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

GetAllByDate ...

func (Images) GetById

func (n Images) GetById(ctx context.Context, id int64) (v *Image, err error)

GetById ...

func (Images) GetByImageName added in v0.2.0

func (n Images) GetByImageName(ctx context.Context, imageName string) (v *Image, err error)

GetByImageName ...

func (*Images) GetFilterList

func (n *Images) GetFilterList(ctx context.Context) (images []*ImageFilterList, err error)

GetFilterList ...

func (*Images) List

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

List ...

func (Images) Update

func (n Images) Update(ctx context.Context, m *Image) (err error)

Update ...

type Log

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

Log ...

func (*Log) TableName

func (m *Log) TableName() string

TableName ...

type LogQuery

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

LogQuery ...

type Logs

type Logs struct {
	Db *gorm.DB
}

Logs ...

func (Logs) Add

func (n Logs) Add(ctx context.Context, v *Log) (id int64, err error)

Add ...

func (*Logs) AddMultiple added in v0.12.0

func (n *Logs) AddMultiple(ctx context.Context, logs []*Log) (err error)

AddMultiple ...

func (Logs) Delete

func (n Logs) Delete(ctx context.Context, mapId int64) (err error)

Delete ...

func (*Logs) DeleteOldest added in v0.9.3

func (n *Logs) DeleteOldest(ctx context.Context, days int) (err error)

DeleteOldest ...

func (Logs) GetById

func (n Logs) GetById(ctx context.Context, id int64) (v *Log, err error)

GetById ...

func (*Logs) List

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

List ...

func (*Logs) Search

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

Search ...

type Message added in v0.0.17

type Message struct {
	Id        int64 `gorm:"primary_key"`
	Type      string
	Payload   json.RawMessage `gorm:"type:jsonb;not null"`
	Statuses  []*MessageDelivery
	CreatedAt time.Time `gorm:"<-:create"`
	UpdatedAt time.Time
}

Message ...

func (*Message) TableName added in v0.0.17

func (d *Message) TableName() string

TableName ...

type MessageDeliveries added in v0.0.17

type MessageDeliveries struct {
	Db *gorm.DB
}

MessageDeliveries ...

func (*MessageDeliveries) Add added in v0.0.17

func (n *MessageDeliveries) Add(ctx context.Context, msg *MessageDelivery) (id int64, err error)

Add ...

func (*MessageDeliveries) Delete added in v0.0.17

func (n *MessageDeliveries) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (*MessageDeliveries) GetAllUncompleted added in v0.0.17

func (n *MessageDeliveries) GetAllUncompleted(ctx context.Context, limit, offset int) (list []*MessageDelivery, total int64, err error)

GetAllUncompleted ...

func (*MessageDeliveries) GetById added in v0.0.17

func (n *MessageDeliveries) GetById(ctx context.Context, id int64) (msg *MessageDelivery, err error)

GetById ...

func (*MessageDeliveries) List added in v0.0.17

func (n *MessageDeliveries) List(ctx context.Context, limit, offset int, orderBy, sort string, queryObj *MessageDeliveryQuery) (list []*MessageDelivery, total int64, err error)

func (*MessageDeliveries) SetStatus added in v0.0.17

func (n *MessageDeliveries) SetStatus(ctx context.Context, msg *MessageDelivery) (err error)

SetStatus ...

type MessageDelivery added in v0.0.17

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

MessageDelivery ...

func (*MessageDelivery) TableName added in v0.0.17

func (d *MessageDelivery) TableName() string

TableName ...

type MessageDeliveryQuery added in v0.10.0

type MessageDeliveryQuery struct {
	StartDate *time.Time `json:"start_date"`
	EndDate   *time.Time `json:"end_date"`
	Types     []string   `json:"types"`
}

MessageDeliveryQuery ...

type Messages added in v0.0.17

type Messages struct {
	Db *gorm.DB
}

Messages ...

func (Messages) Add added in v0.0.17

func (n Messages) Add(ctx context.Context, msg *Message) (id int64, err error)

Add ...

type Metric added in v0.5.0

type Metric struct {
	Id          int64 `gorm:"primary_key"`
	Data        []*MetricBucket
	Name        string
	Description string
	Options     json.RawMessage `gorm:"type:jsonb;not null"`
	Type        common.MetricType
	UpdatedAt   time.Time
	CreatedAt   time.Time `gorm:"<-:create"`
}

Metric ...

func (Metric) TableName added in v0.5.0

func (Metric) TableName() string

TableName ...

type MetricBucket added in v0.5.0

type MetricBucket struct {
	Value    json.RawMessage `gorm:"type:jsonb;not null"`
	Metric   *Metric
	Mins     time.Time `gorm:"->"`
	MetricId int64
	Time     time.Time
}

MetricBucket ...

func (*MetricBucket) TableName added in v0.5.0

func (d *MetricBucket) TableName() string

TableName ...

type MetricBuckets added in v0.5.0

type MetricBuckets struct {
	Db        *gorm.DB
	Timescale bool
}

MetricBuckets ...

func (MetricBuckets) Add added in v0.5.0

func (n MetricBuckets) Add(ctx context.Context, metric *MetricBucket) (err error)

Add ...

func (*MetricBuckets) AddMultiple added in v0.12.0

func (n *MetricBuckets) AddMultiple(ctx context.Context, buckets []*MetricBucket) (err error)

AddMultiple ...

func (MetricBuckets) DeleteById added in v0.5.0

func (n MetricBuckets) DeleteById(ctx context.Context, id int64) (err error)

DeleteById ...

func (MetricBuckets) DeleteByMetricId added in v0.5.0

func (n MetricBuckets) DeleteByMetricId(ctx context.Context, metricId int64) (err error)

DeleteByMetricId ...

func (*MetricBuckets) DeleteOldest added in v0.5.0

func (n *MetricBuckets) DeleteOldest(ctx context.Context, days int) (err error)

DeleteOldest ...

func (*MetricBuckets) List added in v0.12.0

func (n *MetricBuckets) List(ctx context.Context, metricId int64, optionItems []string, rFrom, rTo *time.Time, metricRange *common.MetricRange) (list []*MetricBucket, err error)

List ...

type Metrics added in v0.5.0

type Metrics struct {
	Db *gorm.DB
}

Metrics ...

func (Metrics) Add added in v0.5.0

func (n Metrics) Add(ctx context.Context, metric *Metric) (id int64, err error)

Add ...

func (*Metrics) AddMultiple added in v0.12.0

func (n *Metrics) AddMultiple(ctx context.Context, metrics []*Metric) (err error)

AddMultiple ...

func (Metrics) Delete added in v0.5.0

func (n Metrics) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (Metrics) GetById added in v0.5.0

func (n Metrics) GetById(ctx context.Context, id int64) (metric *Metric, err error)

GetById ...

func (*Metrics) List added in v0.5.0

func (n *Metrics) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*Metric, total int64, err error)

List ...

func (*Metrics) Search added in v0.5.0

func (n *Metrics) Search(ctx context.Context, query string, limit, offset int) (list []*Metric, total int64, err error)

Search ...q

func (Metrics) Update added in v0.5.0

func (n Metrics) Update(ctx context.Context, m *Metric) (err error)

Update ...

type Permission

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

Permission ...

func (*Permission) TableName

func (m *Permission) TableName() string

TableName ...

type Permissions

type Permissions struct {
	Db *gorm.DB
}

Permissions ...

func (Permissions) Add

func (n Permissions) Add(ctx context.Context, permission *Permission) (id int64, err error)

Add ...

func (Permissions) Delete

func (n Permissions) Delete(ctx context.Context, roleName, packageName string, levelName []string) (err error)

Delete ...

func (Permissions) GetAllPermissions

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

GetAllPermissions ...

type Plugin added in v0.5.0

type Plugin struct {
	Name     string `gorm:"primary_key"`
	Version  string
	Enabled  bool
	System   bool
	Actor    bool
	Settings json.RawMessage `gorm:"type:jsonb;not null"`
}

Plugin ...

func (Plugin) TableName added in v0.5.0

func (d Plugin) TableName() string

TableName ...

type Plugins added in v0.5.0

type Plugins struct {
	Db *gorm.DB
}

Plugins ...

func (Plugins) Add added in v0.5.0

func (n Plugins) Add(ctx context.Context, plugin *Plugin) (err error)

Add ...

func (Plugins) CreateOrUpdate added in v0.5.0

func (n Plugins) CreateOrUpdate(ctx context.Context, v *Plugin) (err error)

CreateOrUpdate ...

func (Plugins) Delete added in v0.5.0

func (n Plugins) Delete(ctx context.Context, name string) (err error)

Delete ...

func (Plugins) GetByName added in v0.5.0

func (n Plugins) GetByName(ctx context.Context, name string) (plugin *Plugin, err error)

GetByName ...

func (Plugins) List added in v0.5.0

func (n Plugins) List(ctx context.Context, limit, offset int, orderBy, sort string, onlyEnabled bool) (list []*Plugin, total int64, err error)

List ...

func (Plugins) Search added in v0.5.0

func (n Plugins) Search(ctx context.Context, query string, limit, offset int) (list []*Plugin, total int64, err error)

Search ...

func (Plugins) Update added in v0.5.0

func (n Plugins) Update(ctx context.Context, m *Plugin) (err error)

Update ...

type Point added in v0.12.0

type Point struct {
	Lon float64 `json:"lon"`
	Lat float64 `json:"lat"`
}

type Polygon added in v0.12.0

type Polygon struct {
	Points []Point
}

func (Polygon) GormDataType added in v0.12.0

func (Polygon) GormDataType() string

func (*Polygon) GormValue added in v0.12.0

func (p *Polygon) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

func (*Polygon) Scan added in v0.12.0

func (p *Polygon) Scan(src any) (err error)

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 `gorm:"<-:create"`
	UpdatedAt   time.Time
}

Role ...

func (*Role) TableName

func (m *Role) TableName() string

TableName ...

type Roles

type Roles struct {
	Db *gorm.DB
}

Roles ...

func (Roles) Add

func (n Roles) Add(ctx context.Context, role *Role) (err error)

Add ...

func (Roles) Delete

func (n Roles) Delete(ctx context.Context, name string) (err error)

Delete ...

func (Roles) GetByName

func (n Roles) GetByName(ctx context.Context, name string) (role *Role, err error)

GetByName ...

func (*Roles) List

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

List ...

func (*Roles) RelData

func (n *Roles) RelData(ctx context.Context, role *Role) (err error)

RelData ...

func (*Roles) Search

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

Search ...

func (Roles) Update

func (n Roles) Update(ctx context.Context, m *Role) (err error)

Update ...

type RunHistory added in v0.5.0

type RunHistory struct {
	Db *gorm.DB
}

RunHistory ...

func (RunHistory) Add added in v0.5.0

func (n RunHistory) Add(ctx context.Context, story *RunStory) (id int64, err error)

Add ...

func (*RunHistory) DeleteOldest added in v0.12.0

func (n *RunHistory) DeleteOldest(ctx context.Context, days int) (err error)

DeleteOldest ...

func (*RunHistory) List added in v0.5.0

func (n *RunHistory) List(ctx context.Context, limit, offset int, orderBy, sort string, from *time.Time) (list []*RunStory, total int64, err error)

List ...

func (RunHistory) Update added in v0.5.0

func (n RunHistory) Update(ctx context.Context, m *RunStory) (err error)

Update ...

type RunStory added in v0.5.0

type RunStory struct {
	Id    int64 `gorm:"primary_key"`
	Start time.Time
	End   *time.Time
}

RunStory ...

func (*RunStory) TableName added in v0.5.0

func (d *RunStory) TableName() string

TableName ...

type Script

type Script struct {
	ScriptInfo
	Id          int64 `gorm:"primary_key"`
	Lang        ScriptLang
	Name        string
	Source      string
	Description string
	Compiled    string
	Versions    []*ScriptVersion
	CreatedAt   time.Time `gorm:"<-:create"`
	UpdatedAt   time.Time
}

Script ...

func (*Script) TableName

func (d *Script) TableName() string

TableName ...

type ScriptInfo added in v0.12.0

type ScriptInfo struct {
	AlexaIntents         int `gorm:"->"`
	EntityActions        int `gorm:"->"`
	EntityScripts        int `gorm:"->"`
	AutomationTriggers   int `gorm:"->"`
	AutomationConditions int `gorm:"->"`
	AutomationActions    int `gorm:"->"`
}

type ScriptVersion added in v0.12.0

type ScriptVersion struct {
	Id        int64 `gorm:"primary_key"`
	Lang      ScriptLang
	Source    string
	ScriptId  int64
	Sum       []byte
	CreatedAt time.Time `gorm:"<-:create"`
}

ScriptVersion ...

func (*ScriptVersion) TableName added in v0.12.0

func (d *ScriptVersion) TableName() string

TableName ...

type ScriptVersions added in v0.12.0

type ScriptVersions struct {
	Db *gorm.DB
}

ScriptVersions ...

func (ScriptVersions) Delete added in v0.12.0

func (n ScriptVersions) Delete(ctx context.Context, id int64) (err error)

Delete ...

type Scripts

type Scripts struct {
	Db *gorm.DB
}

Scripts ...

func (Scripts) Add

func (n Scripts) Add(ctx context.Context, script *Script) (id int64, err error)

Add ...

func (Scripts) Delete

func (n Scripts) Delete(ctx context.Context, scriptId int64) (err error)

Delete ...

func (Scripts) GetById

func (n Scripts) GetById(ctx context.Context, scriptId int64) (script *Script, err error)

GetById ...

func (Scripts) GetByName added in v0.5.0

func (n Scripts) GetByName(ctx context.Context, name string) (script *Script, err error)

GetByName ...

func (*Scripts) List

func (n *Scripts) List(ctx context.Context, limit, offset int, orderBy, sort string, query *string, ids *[]uint64) (list []*Script, total int64, err error)

List ...

func (*Scripts) Search

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

Search ...

func (*Scripts) Statistic added in v0.12.0

func (n *Scripts) Statistic(ctx context.Context) (statistic *ScriptsStatistic, err error)

Statistic ...

func (Scripts) Update

func (n Scripts) Update(ctx context.Context, script *Script) (err error)

Update ...

type ScriptsStatistic added in v0.12.0

type ScriptsStatistic struct {
	Total        int32
	Used         int32
	Unused       int32
	CoffeeScript int32
	TypeScript   int32
	JavaScript   int32
}

type Tag added in v0.17.0

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

Tag ...

func (*Tag) TableName added in v0.17.0

func (d *Tag) TableName() string

TableName ...

type Tags added in v0.17.0

type Tags struct {
	Db *gorm.DB
}

Tags ...

func (Tags) Add added in v0.17.0

func (n Tags) Add(ctx context.Context, tag *Tag) (id int64, err error)

Add ...

func (*Tags) Delete added in v0.17.0

func (n *Tags) Delete(ctx context.Context, name string) (err error)

Delete ...

func (*Tags) GetById added in v0.17.0

func (n *Tags) GetById(ctx context.Context, id int64) (tag *Tag, err error)

GetById ...

func (*Tags) GetByName added in v0.17.0

func (n *Tags) GetByName(ctx context.Context, name string) (tag *Tag, err error)

GetByName ...

func (*Tags) List added in v0.17.0

func (n *Tags) List(ctx context.Context, limit, offset int, orderBy, sort string, query *string, names *[]string) (list []*Tag, total int64, err error)

List ...

func (*Tags) Search added in v0.17.0

func (n *Tags) Search(ctx context.Context, query string, limit, offset int) (list []*Tag, total int64, err error)

Search ...

func (*Tags) Update added in v0.17.0

func (n *Tags) Update(ctx context.Context, tag *Tag) (err error)

Update ...

type Task added in v0.5.0

type Task struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Description string
	Enabled     bool
	Condition   common.ConditionType
	Conditions  []*Condition `gorm:"many2many:task_conditions;"`
	Actions     []*Action    `gorm:"many2many:task_actions;"`
	Triggers    []*Trigger   `gorm:"many2many:task_triggers;"`
	AreaId      *int64
	Area        *Area
	CreatedAt   time.Time `gorm:"<-:create"`
	UpdatedAt   time.Time
}

Task ...

func (*Task) TableName added in v0.5.0

func (d *Task) TableName() string

TableName ...

type TaskAction added in v0.12.0

type TaskAction struct {
	Task     *Task
	TaskId   string `gorm:"primary_key;auto_increment:false"`
	Action   *Action
	ActionId int64 `gorm:"primary_key;auto_increment:false"`
}

TaskAction ...

func (TaskAction) TableName added in v0.12.0

func (TaskAction) TableName() string

TableName ...

type TaskCondition added in v0.12.0

type TaskCondition struct {
	Task        *Task
	TaskId      string `gorm:"primary_key;auto_increment:false"`
	Condition   *Condition
	ConditionId int64 `gorm:"primary_key;auto_increment:false"`
}

TaskCondition ...

func (TaskCondition) TableName added in v0.12.0

func (TaskCondition) TableName() string

TableName ...

type TaskTrigger added in v0.12.0

type TaskTrigger struct {
	Task      *Task
	TaskId    string `gorm:"primary_key;auto_increment:false"`
	Trigger   *Trigger
	TriggerId int64 `gorm:"primary_key;auto_increment:false"`
}

TaskTrigger ...

func (TaskTrigger) TableName added in v0.12.0

func (TaskTrigger) TableName() string

TableName ...

type Tasks added in v0.5.0

type Tasks struct {
	Db *gorm.DB
}

Tasks ...

func (Tasks) Add added in v0.5.0

func (n Tasks) Add(ctx context.Context, task *Task) (id int64, err error)

Add ...

func (Tasks) Delete added in v0.5.0

func (n Tasks) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (Tasks) DeleteAction added in v0.12.0

func (n Tasks) DeleteAction(ctx context.Context, id int64) (err error)

DeleteAction ...

func (Tasks) DeleteCondition added in v0.12.0

func (n Tasks) DeleteCondition(ctx context.Context, id int64) (err error)

DeleteCondition ...

func (Tasks) DeleteTrigger added in v0.12.0

func (n Tasks) DeleteTrigger(ctx context.Context, id int64) (err error)

DeleteTrigger ...

func (Tasks) Disable added in v0.5.3

func (n Tasks) Disable(ctx context.Context, id int64) (err error)

Disable ...

func (Tasks) Enable added in v0.5.3

func (n Tasks) Enable(ctx context.Context, id int64) (err error)

Enable ...

func (Tasks) GetById added in v0.5.0

func (n Tasks) GetById(ctx context.Context, taskId int64) (task *Task, err error)

GetById ...

func (Tasks) List added in v0.5.0

func (n Tasks) List(ctx context.Context, limit, offset int, orderBy, sort string, onlyEnabled bool) (list []*Task, total int64, err error)

List ...

func (Tasks) Search added in v0.5.0

func (n Tasks) Search(ctx context.Context, query string, limit, offset int) (list []*Task, total int64, err error)

Search ...

func (Tasks) Update added in v0.5.0

func (n Tasks) Update(ctx context.Context, task *Task) (err error)

Update ...

type TelegramChat added in v0.5.0

type TelegramChat struct {
	EntityId  common.EntityId
	ChatId    int64
	Username  string
	CreatedAt time.Time `gorm:"<-:create"`
}

TelegramChat ...

func (*TelegramChat) TableName added in v0.5.0

func (d *TelegramChat) TableName() string

TableName ...

type TelegramChats added in v0.5.0

type TelegramChats struct {
	Db *gorm.DB
}

TelegramChats ...

func (TelegramChats) Add added in v0.5.0

func (n TelegramChats) Add(ctx context.Context, ch TelegramChat) (err error)

Add ...

func (TelegramChats) Delete added in v0.5.0

func (n TelegramChats) Delete(ctx context.Context, entityId common.EntityId, chatId int64) (err error)

Delete ...

func (*TelegramChats) List added in v0.5.0

func (n *TelegramChats) List(ctx context.Context, limit, offset int, orderBy, sort string, entityId common.EntityId) (list []TelegramChat, total int64, err error)

List ...

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 `gorm:"<-:create"`
	UpdatedAt   time.Time
}

Template ...

func (*Template) TableName added in v0.0.17

func (d *Template) TableName() string

TableName ...

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"`
}

TemplateTree ...

type Templates added in v0.0.17

type Templates struct {
	Db *gorm.DB
}

Templates ...

func (Templates) Create added in v0.0.17

func (n Templates) Create(ctx context.Context, tpl *Template) (err error)

Create ...

func (Templates) Delete added in v0.0.17

func (n Templates) Delete(ctx context.Context, name string) (err error)

Delete ...

func (Templates) GetByName added in v0.0.17

func (n Templates) GetByName(ctx context.Context, name, itemType string) (*Template, error)

GetByName ...

func (Templates) GetItemsSortedList added in v0.0.17

func (n Templates) GetItemsSortedList(ctx context.Context) (count int64, newItems []string, err error)

GetItemsSortedList ...

func (Templates) GetItemsTree added in v0.0.17

func (n Templates) GetItemsTree(ctx context.Context) (tree []*TemplateTree, err error)

GetItemsTree ...

func (Templates) GetList added in v0.0.17

func (n Templates) GetList(ctx context.Context, templateType string) ([]*Template, error)

GetList ...

func (*Templates) Search added in v0.0.17

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

Search ...

func (Templates) Update added in v0.0.17

func (n Templates) Update(ctx context.Context, m *Template) error

Update ...

func (Templates) UpdateItemsTree added in v0.0.17

func (n Templates) UpdateItemsTree(ctx context.Context, tree []*TemplateTree, parent string) error

UpdateItemsTree ...

func (Templates) UpdateOrCreate added in v0.0.17

func (n Templates) UpdateOrCreate(ctx context.Context, tpl *Template) (err error)

UpdateOrCreate ...

func (Templates) UpdateStatus added in v0.0.17

func (n Templates) UpdateStatus(ctx context.Context, m *Template) error

UpdateStatus ...

type Trigger added in v0.5.0

type Trigger struct {
	Id          int64 `gorm:"primary_key"`
	Name        string
	Entities    []*Entity `gorm:"many2many:trigger_entities;"`
	Script      *Script
	ScriptId    *int64
	PluginName  string
	Payload     string
	Enabled     bool
	AreaId      *int64
	Area        *Area
	Description string
	CreatedAt   time.Time `gorm:"<-:create"`
	UpdatedAt   time.Time
}

Trigger ...

func (*Trigger) TableName added in v0.5.0

func (*Trigger) TableName() string

TableName ...

type TriggerEntity added in v0.13.2

type TriggerEntity struct {
	Trigger   *Trigger
	TriggerId int64 `gorm:"primary_key;auto_increment:false"`
	Entity    *Entity
	EntityId  string `gorm:"primary_key;auto_increment:false"`
}

TriggerEntity ...

func (TriggerEntity) TableName added in v0.13.2

func (TriggerEntity) TableName() string

TableName ...

type Triggers added in v0.5.0

type Triggers struct {
	Db *gorm.DB
}

Triggers ...

func (Triggers) Add added in v0.12.0

func (t Triggers) Add(ctx context.Context, trigger *Trigger) (id int64, err error)

Add ...

func (Triggers) Delete added in v0.12.0

func (t Triggers) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (Triggers) DeleteEntity added in v0.13.2

func (t Triggers) DeleteEntity(ctx context.Context, id int64) (err error)

DeleteEntity ...

func (Triggers) Disable added in v0.12.0

func (t Triggers) Disable(ctx context.Context, id int64) (err error)

Disable ...

func (Triggers) Enable added in v0.12.0

func (t Triggers) Enable(ctx context.Context, id int64) (err error)

Enable ...

func (Triggers) GetById added in v0.12.0

func (t Triggers) GetById(ctx context.Context, id int64) (trigger *Trigger, err error)

GetById ...

func (Triggers) List added in v0.12.0

func (t Triggers) List(ctx context.Context, limit, offset int, orderBy, sort string, onlyEnabled bool) (list []*Trigger, total int64, err error)

List ...

func (Triggers) ListPlain added in v0.14.0

func (t Triggers) ListPlain(ctx context.Context, limit, offset int, orderBy, sort string, onlyEnabled bool, ids *[]uint64) (list []*Trigger, total int64, err error)

ListPlain ...

func (Triggers) Search added in v0.12.0

func (t Triggers) Search(ctx context.Context, query string, limit, offset int) (list []*Trigger, total int64, err error)

Search ...

func (Triggers) Update added in v0.12.0

func (t Triggers) Update(ctx context.Context, trigger *Trigger) (err error)

Update ...

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 `gorm:"foreignKey:UserId;constraint:OnUpdate:CASCADE;"`
	Devices             []*UserDevice
	ResetPasswordSentAt *time.Time
	CurrentSignInAt     *time.Time
	LastSignInAt        *time.Time
	CreatedAt           time.Time `gorm:"<-:create"`
	UpdatedAt           time.Time
	DeletedAt           *time.Time
	History             json.RawMessage `gorm:"type:jsonb;not null"`
}

User ...

func (*User) TableName

func (u *User) TableName() string

TableName ...

type UserDevice added in v0.9.5

type UserDevice struct {
	Id               int64 `gorm:"primary_key"`
	UserId           int64
	PushRegistration json.RawMessage `gorm:"type:jsonb;not null"`
	CreatedAt        time.Time       `gorm:"<-:create"`
}

UserDevice ...

func (*UserDevice) TableName added in v0.9.5

func (d *UserDevice) TableName() string

TableName ...

type UserDevices added in v0.9.5

type UserDevices struct {
	Db *gorm.DB
}

UserDevices ...

func (*UserDevices) Add added in v0.9.5

func (d *UserDevices) Add(ctx context.Context, device *UserDevice) (id int64, err error)

Add ...

func (*UserDevices) Delete added in v0.9.5

func (d *UserDevices) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (*UserDevices) GetByUserId added in v0.9.5

func (d *UserDevices) GetByUserId(ctx context.Context, id int64) (devices []*UserDevice, err error)

GetByUserId ...

func (*UserDevices) List added in v0.17.0

func (d *UserDevices) List(ctx context.Context, limit, offset int, orderBy, sort string) (list []*UserDevice, total int64, err error)

List ...

type UserMeta

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

UserMeta ...

func (*UserMeta) TableName

func (m *UserMeta) TableName() string

TableName ...

type UserMetas

type UserMetas struct {
	Db *gorm.DB
}

UserMetas ...

func (*UserMetas) UpdateOrCreate

func (m *UserMetas) UpdateOrCreate(ctx context.Context, meta *UserMeta) (id int64, err error)

UpdateOrCreate ...

type Users

type Users struct {
	Db *gorm.DB
}

Users ...

func (*Users) Add

func (u *Users) Add(ctx context.Context, user *User) (id int64, err error)

Add ...

func (*Users) ClearResetPassToken

func (u *Users) ClearResetPassToken(ctx context.Context, userId int64) (err error)

ClearResetPassToken ...

func (*Users) ClearToken

func (u *Users) ClearToken(ctx context.Context, userId int64) (err error)

ClearToken ...

func (*Users) Delete

func (u *Users) Delete(ctx context.Context, userId int64) (err error)

Delete ...

func (*Users) GetByAuthenticationToken

func (u *Users) GetByAuthenticationToken(ctx context.Context, token string) (user *User, err error)

GetByAuthenticationToken ...

func (*Users) GetByEmail

func (u *Users) GetByEmail(ctx context.Context, email string) (user *User, err error)

GetByEmail ...

func (*Users) GetById

func (u *Users) GetById(ctx context.Context, userId int64) (user *User, err error)

GetById ...

func (*Users) GetByNickname added in v0.2.0

func (u *Users) GetByNickname(ctx context.Context, nickname string) (user *User, err error)

GetByNickname ...

func (*Users) GetByResetPassToken

func (u *Users) GetByResetPassToken(ctx context.Context, token string) (user *User, err error)

GetByResetPassToken ...

func (*Users) List

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

List ...

func (*Users) NewResetPassToken

func (u *Users) NewResetPassToken(ctx context.Context, userId int64, token string) (err error)

NewResetPassToken ...

func (*Users) Update

func (u *Users) Update(ctx context.Context, user *User) (err error)

Update ...

func (*Users) UpdateAuthenticationToken

func (u *Users) UpdateAuthenticationToken(ctx context.Context, userId int64, token string) (err error)

UpdateAuthenticationToken ...

type Variable

type Variable struct {
	Name      string `gorm:"primary_key"`
	Value     string
	System    bool
	EntityId  *common.EntityId
	Tags      []*Tag    `gorm:"many2many:variable_tags;"`
	CreatedAt time.Time `gorm:"<-:create"`
	UpdatedAt time.Time
}

Variable ...

func (*Variable) TableName

func (d *Variable) TableName() string

TableName ...

type VariableTag added in v0.17.0

type VariableTag struct {
	VariableName string `gorm:"primary_key;auto_increment:false"`
	TagName      string `gorm:"primary_key;auto_increment:false"`
}

VariableTag ...

func (*VariableTag) TableName added in v0.17.0

func (d *VariableTag) TableName() string

TableName ...

type VariableTags added in v0.17.0

type VariableTags struct {
}

VariableTags ...

type Variables

type Variables struct {
	Db *gorm.DB
}

Variables ...

func (Variables) Add

func (n Variables) Add(ctx context.Context, variable Variable) (err error)

Add ...

func (*Variables) CreateOrUpdate added in v0.5.0

func (n *Variables) CreateOrUpdate(ctx context.Context, v Variable) (err error)

CreateOrUpdate ...

func (Variables) Delete

func (n Variables) Delete(ctx context.Context, name string) (err error)

Delete ...

func (Variables) DeleteTags added in v0.17.0

func (n Variables) DeleteTags(ctx context.Context, name string) (err error)

DeleteTags ...

func (Variables) GetAllSystem added in v0.6.0

func (n Variables) GetAllSystem(ctx context.Context) (list []Variable, err error)

GetAllSystem ...

func (Variables) GetByName

func (n Variables) GetByName(ctx context.Context, name string) (variable Variable, err error)

GetByName ...

func (*Variables) List

func (n *Variables) List(ctx context.Context, limit, offset int, orderBy, sort string, system bool, name string) (list []Variable, total int64, err error)

List ...

func (*Variables) Search added in v0.9.4

func (s *Variables) Search(ctx context.Context, query string, limit, offset int) (list []Variable, total int64, err error)

Search ...

func (Variables) Update

func (n Variables) Update(ctx context.Context, m Variable) (err error)

Update ...

type Zigbee2mqtt added in v0.1.0

type Zigbee2mqtt struct {
	Id                int64 `gorm:"primary_key"`
	Name              string
	Login             string
	Devices           []*Zigbee2mqttDevice
	EncryptedPassword string
	PermitJoin        bool
	BaseTopic         string
	CreatedAt         time.Time `gorm:"<-:create"`
	UpdatedAt         time.Time
}

Zigbee2mqtt ...

func (*Zigbee2mqtt) TableName added in v0.1.0

func (m *Zigbee2mqtt) TableName() string

TableName ...

type Zigbee2mqttDevice added in v0.1.0

type Zigbee2mqttDevice struct {
	Id            string `gorm:"primary_key"`
	Zigbee2mqtt   *Zigbee2mqtt
	Zigbee2mqttId int64
	Name          string
	Type          string
	Model         string
	Description   string
	Manufacturer  string
	Status        string
	Functions     pq.StringArray  `gorm:"type:varchar(100)[]"`
	Payload       json.RawMessage `gorm:"type:jsonb;not null"`
	CreatedAt     time.Time       `gorm:"<-:create"`
	UpdatedAt     time.Time
}

Zigbee2mqttDevice ...

func (*Zigbee2mqttDevice) TableName added in v0.1.0

func (m *Zigbee2mqttDevice) TableName() string

TableName ...

type Zigbee2mqttDevices added in v0.1.0

type Zigbee2mqttDevices struct {
	Db *gorm.DB
}

Zigbee2mqttDevices ...

func (Zigbee2mqttDevices) Add added in v0.1.0

Add ...

func (Zigbee2mqttDevices) Delete added in v0.1.0

func (z Zigbee2mqttDevices) Delete(ctx context.Context, id string) (err error)

Delete ...

func (Zigbee2mqttDevices) GetById added in v0.1.0

func (z Zigbee2mqttDevices) GetById(ctx context.Context, id string) (v *Zigbee2mqttDevice, err error)

GetById ...

func (*Zigbee2mqttDevices) List added in v0.1.0

func (z *Zigbee2mqttDevices) List(ctx context.Context, limit, offset int) (list []*Zigbee2mqttDevice, total int64, err error)

List ...

func (*Zigbee2mqttDevices) ListByBridgeId added in v0.5.2

func (z *Zigbee2mqttDevices) ListByBridgeId(ctx context.Context, bridgeId int64, limit, offset int, orderBy, sort string) (list []*Zigbee2mqttDevice, total int64, err error)

ListByBridgeId ...

func (*Zigbee2mqttDevices) Search added in v0.1.0

func (z *Zigbee2mqttDevices) Search(ctx context.Context, query string, limit, offset int) (list []*Zigbee2mqttDevice, total int64, err error)

Search ...

func (Zigbee2mqttDevices) Update added in v0.1.0

func (z Zigbee2mqttDevices) Update(ctx context.Context, m *Zigbee2mqttDevice) (err error)

Update ...

type Zigbee2mqtts added in v0.1.0

type Zigbee2mqtts struct {
	Db *gorm.DB
}

Zigbee2mqtts ...

func (Zigbee2mqtts) Add added in v0.1.0

func (z Zigbee2mqtts) Add(ctx context.Context, v *Zigbee2mqtt) (id int64, err error)

Add ...

func (Zigbee2mqtts) Delete added in v0.1.0

func (z Zigbee2mqtts) Delete(ctx context.Context, id int64) (err error)

Delete ...

func (Zigbee2mqtts) GetById added in v0.1.0

func (z Zigbee2mqtts) GetById(ctx context.Context, id int64) (v *Zigbee2mqtt, err error)

GetById ...

func (*Zigbee2mqtts) GetByLogin added in v0.1.0

func (z *Zigbee2mqtts) GetByLogin(ctx context.Context, login string) (bridge *Zigbee2mqtt, err error)

GetByLogin ...

func (*Zigbee2mqtts) List added in v0.1.0

func (z *Zigbee2mqtts) List(ctx context.Context, limit, offset int) (list []*Zigbee2mqtt, total int64, err error)

List ...

func (Zigbee2mqtts) Update added in v0.1.0

func (z Zigbee2mqtts) Update(ctx context.Context, m *Zigbee2mqtt) (err error)

Update ...

Jump to

Keyboard shortcuts

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