models

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MessageStatusNew ...
	MessageStatusNew = MessageStatus("new")
	// MessageStatusInProgress ...
	MessageStatusInProgress = MessageStatus("in_progress")
	// MessageStatusSucceed ...
	MessageStatusSucceed = MessageStatus("succeed")
	// MessageStatusError ...
	MessageStatusError = MessageStatus("error")
)
View Source
const (
	// TemplateStatusActive ...
	TemplateStatusActive = TemplateStatus("active")
	// TemplateStatusUnactive ...
	TemplateStatusUnactive = TemplateStatus("inactive")
	// TemplateTypeItem ...
	TemplateTypeItem = TemplateType("item")
	// TemplateTypeTemplate ...
	TemplateTypeTemplate = TemplateType("template")
)
View Source
const HistoryMax = 8

HistoryMax ...

Variables

This section is empty.

Functions

func PreviewTemplate added in v0.0.17

func PreviewTemplate(items []*Template, template *TemplateContent) (data string, err error)

PreviewTemplate ...

func TemplateGetParents added in v0.0.17

func TemplateGetParents(items Templates, result *Templates, s string)

TemplateGetParents ...

Types

type Action added in v0.5.0

type Action struct {
	Id       int64   `json:"id"`
	Name     string  `json:"name" validate:"required,lte=255"`
	TaskId   int64   `json:"task_id"`
	Script   *Script `json:"script"`
	ScriptId int64   `json:"script_id" validate:"required"`
}

Action ...

type AlexaIntent added in v0.3.0

type AlexaIntent struct {
	Name         string    `json:"name"`
	AlexaSkillId int64     `json:"alexa_skill_id" validate:"required"`
	Script       *Script   `json:"script"`
	ScriptId     int64     `json:"script_id" validate:"required"`
	Description  string    `json:"description"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

AlexaIntent ...

type AlexaSkill added in v0.3.0

type AlexaSkill struct {
	Id          int64             `json:"id"`
	SkillId     string            `json:"skill_id" validate:"required"`
	Description string            `json:"description"`
	Status      common.StatusType `json:"status" validate:"required"`
	Intents     []*AlexaIntent    `json:"intents"`
	Script      *Script           `json:"script"`
	ScriptId    *int64            `json:"script_id"`
	CreatedAt   time.Time         `json:"created_at"`
	UpdatedAt   time.Time         `json:"updated_at"`
}

AlexaSkill ...

type AppConfig added in v0.5.0

type AppConfig struct {
	PgUser                         string         `json:"pg_user" env:"PG_USER"`
	PgPass                         string         `json:"pg_pass" env:"PG_PASS"`
	PgHost                         string         `json:"pg_host" env:"PG_HOST"`
	PgName                         string         `json:"pg_name" env:"PG_NAME"`
	PgPort                         string         `json:"pg_port" env:"PG_PORT"`
	PgDebug                        bool           `json:"pg_debug" env:"PG_DEBUG"`
	PgLogger                       bool           `json:"pg_logger" env:"PG_LOGGER"`
	PgMaxIdleConns                 int            `json:"pg_max_idle_conns" env:"PG_MAX_IDLE_CONNS"`
	PgMaxOpenConns                 int            `json:"pg_max_open_conns" env:"PG_MAX_OPEN_CONNS"`
	PgConnMaxLifeTime              int            `json:"pg_conn_max_life_time" env:"PG_CONN_MAX_LIFE_TIME"`
	AutoMigrate                    bool           `json:"auto_migrate" env:"AUTO_MIGRATE"`
	SnapshotDir                    string         `json:"snapshot_dir" env:"SNAPSHOT_DIR"`
	Mode                           common.RunMode `json:"mode" env:"MODE"`
	MqttPort                       int            `json:"mqtt_port" env:"MQTT_PORT"`
	MqttRetryInterval              time.Duration  `json:"mqtt_retry_interval" env:"MQTT_RETRY_INTERVAL"`
	MqttRetryCheckInterval         time.Duration  `json:"mqtt_retry_check_interval" env:"MQTT_RETRY_CHECK_INTERVAL"`
	MqttSessionExpiryInterval      time.Duration  `json:"mqtt_session_expiry_interval" env:"MQTT_SESSION_EXPIRY_INTERVAL"`
	MqttSessionExpireCheckInterval time.Duration  `json:"mqtt_session_expire_check_interval" env:"MQTT_SESSION_EXPIRE_CHECK_INTERVAL"`
	MqttQueueQos0Messages          bool           `json:"mqtt_queue_qos_0_messages" env:"MQTT_QUEUE_QOS_0_MESSAGES"`
	MqttMaxInflight                int            `json:"mqtt_max_inflight" env:"MQTT_MAX_INFLIGHT"`
	MqttMaxAwaitRel                int            `json:"mqtt_max_await_rel" env:"MQTT_MAX_AWAIT_REL"`
	MqttMaxMsgQueue                int            `json:"mqtt_max_msg_queue" env:"MQTT_MAX_MSG_QUEUE"`
	MqttDeliverMode                int            `json:"mqtt_deliver_mode" env:"MQTT_DELIVER_MODE"`
	Logging                        bool           `json:"logging" env:"LOGGING"`
	Metric                         bool           `json:"metric" env:"METRIC"`
	MetricPort                     int            `json:"metric_port" env:"METRIC_PORT"`
	ColoredLogging                 bool           `json:"colored_logging" env:"API_GRPC_HOST_PORT"`
	AlexaHost                      string         `json:"alexa_host" env:"ALEXA_HOST"`
	AlexaPort                      int            `json:"alexa_port" env:"ALEXA_PORT"`
	MobileHost                     string         `json:"mobile_host" env:"MOBILE_HOST"`
	MobilePort                     int            `json:"mobile_port" env:"MOBILE_PORT"`
	ApiGrpcHostPort                string         `json:"api_grpc_host_port" env:"API_GRPC_HOST_PORT"`
	ApiHttpHostPort                string         `json:"api_http_host_port" env:"API_HTTP_HOST_PORT"`
	ApiPromHostPort                string         `json:"api_prom_host_port" env:"API_PROM_HOST_PORT"`
	ApiWsHostPort                  string         `json:"api_ws_host_port" env:"API_WS_HOST_PORT"`
	ApiSwagger                     bool           `json:"api_swagger" env:"API_SWAGGER"`
	Lang                           string         `json:"lang" env:"LANG"`
	GodMode                        bool           `json:"god_mode" env:"GOD_MODE"`
}

AppConfig ...

type Area added in v0.5.0

type Area struct {
	Id          int64  `json:"id"`
	Name        string `json:"name" validate:"required"`
	Description string `json:"description"`
}

Area ...

type Attribute added in v0.5.0

type Attribute struct {
	Name  string               `json:"name"`
	Type  common.AttributeType `json:"type"`
	Value interface{}          `json:"value,omitempty"`
}

Attribute ...

func (Attribute) Bool added in v0.5.0

func (a Attribute) Bool() bool

Bool ...

func (Attribute) Float64 added in v0.5.0

func (a Attribute) Float64() float64

Float64 ...

func (Attribute) Int64 added in v0.5.0

func (a Attribute) Int64() int64

Int64 ...

func (Attribute) Map added in v0.5.0

func (a Attribute) Map() Attributes

Map ...

func (Attribute) String added in v0.5.0

func (a Attribute) String() string

String ...

func (Attribute) Time added in v0.5.0

func (a Attribute) Time() time.Time

Time ...

type AttributeValue added in v0.5.0

type AttributeValue map[string]interface{}

AttributeValue ...

type Attributes added in v0.5.0

type Attributes map[string]*Attribute

Attributes ...

func (Attributes) Copy added in v0.5.0

func (a Attributes) Copy() (copy Attributes)

Copy ...

func (Attributes) Deserialize added in v0.5.0

func (a Attributes) Deserialize(data AttributeValue) (changed bool, err error)

Deserialize ...

func (Attributes) Serialize added in v0.5.0

func (a Attributes) Serialize() (to AttributeValue)

Serialize ...

func (Attributes) Signature added in v0.5.0

func (a Attributes) Signature() (signature Attributes)

Signature ...

type Condition added in v0.5.0

type Condition struct {
	Id       int64   `json:"id"`
	Name     string  `json:"name" validate:"required,lte=255"`
	TaskId   int64   `json:"task_id"`
	Script   *Script `json:"script"`
	ScriptId int64   `json:"script_id" validate:"required"`
}

Condition ...

type Entity added in v0.5.0

type Entity struct {
	Id          common.EntityId  `json:"id"`
	Description string           `json:"description"`
	PluginName  string           `json:"plugin_name" validate:"required"`
	Icon        *string          `json:"icon"`
	Image       *Image           `json:"image"`
	Actions     []*EntityAction  `json:"actions"`
	States      []*EntityState   `json:"states"`
	Area        *Area            `json:"area"`
	AreaId      *int64           `json:"area_id"`
	Metrics     []Metric         `json:"metrics"`
	Scripts     []*Script        `json:"scripts"`
	Hidden      bool             `json:"hidden"`
	Attributes  Attributes       `json:"attributes"`
	Settings    Attributes       `json:"settings"`
	AutoLoad    bool             `json:"auto_load"`
	ParentId    *common.EntityId `json:"parent_id"`
	CreatedAt   time.Time        `json:"created_at"`
	UpdatedAt   time.Time        `json:"updated_at"`
}

Entity ...

type EntityAction added in v0.5.0

type EntityAction struct {
	Id          int64           `json:"id"`
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Icon        *string         `json:"icon"`
	EntityId    common.EntityId `json:"entity_id" validate:"required"`
	Image       *Image          `json:"image"`
	ImageId     *int64          `json:"image_id" validate:"required"`
	Script      *Script         `json:"script"`
	ScriptId    *int64          `json:"script_id" validate:"required"`
	Type        string          `json:"type"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
}

EntityAction ...

func (*EntityAction) Short added in v0.5.0

func (a *EntityAction) Short() (short EntityActionShort)

Short ...

type EntityActionShort added in v0.5.0

type EntityActionShort struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	ImageUrl    *string `json:"image_url"`
	Icon        *string `json:"icon"`
}

EntityActionShort ...

type EntityPayload added in v0.5.0

type EntityPayload struct {
	AttributeSignature Attributes `json:"attribute_signature"`
}

EntityPayload ...

type EntitySettings added in v0.5.0

type EntitySettings struct {
	Settings Attributes `json:"settings"`
}

EntitySettings ...

type EntityShort added in v0.5.0

type EntityShort struct {
	Id          common.EntityId     `json:"id"`
	Type        string              `json:"type"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Icon        *string             `json:"icon"`
	ImageUrl    *string             `json:"image_url"`
	Actions     []EntityActionShort `json:"actions"`
	States      []EntityStateShort  `json:"states"`
	State       *EntityStateShort   `json:"state"`
	Attributes  Attributes          `json:"attributes"`
	Area        *Area               `json:"area"`
	Metrics     []Metric            `json:"metrics"`
	Hidden      bool                `json:"hidden"`
}

EntityShort ...

type EntityState added in v0.5.0

type EntityState struct {
	Id          int64           `json:"id"`
	Name        string          `json:"name" validate:"max=254;required"`
	Description string          `json:"description"`
	Icon        *string         `json:"icon"`
	EntityId    common.EntityId `json:"entity_id" validate:"required"`
	Image       *Image          `json:"image"`
	ImageId     *int64          `json:"image_id" validate:"required"`
	Style       string          `json:"style"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
}

EntityState ...

func (*EntityState) Short added in v0.5.0

func (m *EntityState) Short() (short EntityStateShort)

Short ...

type EntityStateShort added in v0.5.0

type EntityStateShort struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	ImageUrl    *string `json:"image_url"`
	Icon        *string `json:"icon"`
}

EntityStateShort ...

type EntityStorage added in v0.5.0

type EntityStorage struct {
	Id         int64           `json:"id"`
	State      string          `json:"state"`
	EntityId   common.EntityId `json:"entity_id"`
	Attributes AttributeValue  `json:"attributes"`
	CreatedAt  time.Time       `json:"created_at"`
}

EntityStorage ...

type GeoLocation added in v0.5.0

type GeoLocation struct {
	Status      string  `json:"status"`
	Country     string  `json:"country"`
	CountryCode string  `json:"countryCode"`
	Region      string  `json:"region"`
	RegionName  string  `json:"regionName"`
	City        string  `json:"city"`
	Zip         string  `json:"zip"`
	Lat         float64 `json:"lat"`
	Lon         float64 `json:"lon"`
	Timezone    string  `json:"timezone"`
	Isp         string  `json:"isp"`
	Org         string  `json:"org"`
	As          string  `json:"as"`
	Query       string  `json:"query"`
}

"status": "success", "country": "Russia", "countryCode": "RU", "region": "NVS", "regionName": "Novosibirsk Oblast", "city": "Novosibirsk", "zip": "630008", "lat": 54.9022, "lon": 83.0335, "timezone": "Asia/Novosibirsk", "isp": "Novotelecom Ltd.", "org": "Novotelecom ltd.", "as": "AS31200 Novotelecom Ltd", "query": "xxx.xxx.xxx.xxx"

type Image

type Image struct {
	Id        int64     `json:"id"`
	Thumb     string    `json:"thumb"`
	Url       string    `json:"url"`
	Image     string    `json:"image"`
	MimeType  string    `json:"mime_type"`
	Title     string    `json:"title"`
	Size      int64     `json:"size"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

Image ...

type ImageFilterList

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

ImageFilterList ...

type Log

type Log struct {
	Id        int64           `json:"id"`
	Body      string          `json:"body" validate:"required"`
	Level     common.LogLevel `json:"level" validate:"required"`
	CreatedAt time.Time       `json:"created_at"`
}

Log ...

type LogQuery

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

LogQuery ...

type Map

type Map struct {
	Id          int64       `json:"id"`
	Name        string      `json:"name" validate:"max=254;required"`
	Description string      `json:"description" validate:"required"`
	Options     MapOptions  `json:"options"`
	Layers      []*MapLayer `json:"layers"`
	CreatedAt   time.Time   `json:"created_at"`
	UpdatedAt   time.Time   `json:"updated_at"`
}

Map ...

type MapElement

type MapElement struct {
	Id            int64                   `json:"id"`
	Name          string                  `json:"name" validate:"required"`
	Description   string                  `json:"description"`
	PrototypeId   interface{}             `json:"prototype_id"`
	PrototypeType MapElementPrototypeType `json:"prototype_type"`
	Prototype     MapElementPrototype     `json:"prototype" validate:"required"`
	MapId         int64                   `json:"map_id" validate:"required"`
	LayerId       int64                   `json:"layer_id" validate:"required"`
	GraphSettings MapElementGraphSettings `json:"graph_settings"`
	Status        StatusType              `json:"status" validate:"required"`
	Weight        int64                   `json:"weight"`
	CreatedAt     time.Time               `json:"created_at"`
	UpdatedAt     time.Time               `json:"updated_at"`
}

Entity ...

type MapElementGraphSettings

type MapElementGraphSettings struct {
	Width    null.Int64                      `json:"width"`
	Height   null.Int64                      `json:"height"`
	Position MapElementGraphSettingsPosition `json:"position"`
}

MapElementGraphSettings ...

type MapElementGraphSettingsPosition

type MapElementGraphSettingsPosition struct {
	Top  int64 `json:"top"`
	Left int64 `json:"left"`
}

MapElementGraphSettingsPosition ...

type MapElementPrototype added in v0.5.0

type MapElementPrototype struct {
	*MapImage
	*MapText
	*Entity
}

MapElementPrototype ...

func (MapElementPrototype) MarshalJSON added in v0.5.0

func (n MapElementPrototype) MarshalJSON() (b []byte, err error)

MarshalJSON ...

func (*MapElementPrototype) UnmarshalJSON added in v0.5.0

func (n *MapElementPrototype) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON ...

type MapImage

type MapImage struct {
	Id      int64  `json:"id"`
	Image   *Image `json:"image"`
	ImageId int64  `json:"image_id" validate:"required"`
	Style   string `json:"style"`
}

MapImage ...

type MapLayer

type MapLayer struct {
	Id          int64         `json:"id"`
	Name        string        `json:"name" validate:"max=254;required"`
	Description string        `json:"description"`
	Map         *Map          `json:"map"`
	MapId       int64         `json:"map_id" validate:"required"`
	Status      string        `json:"status" validate:"required"`
	Weight      int64         `json:"weight"`
	Elements    []*MapElement `json:"elements"`
	CreatedAt   time.Time     `json:"created_at"`
	UpdatedAt   time.Time     `json:"updated_at"`
}

MapLayer ...

type MapOptions

type MapOptions struct {
	Zoom              float64 `json:"zoom"`
	ElementStateText  bool    `json:"element_state_text"`
	ElementOptionText bool    `json:"element_option_text"`
}

MapOptions ...

type MapText

type MapText struct {
	Id    int64  `json:"id"`
	Text  string `json:"text" validate:"required"`
	Style string `json:"style"`
}

MapText ...

type Message added in v0.0.17

type Message struct {
	Id         int64          `json:"id"`
	Type       string         `json:"type"`
	Attributes AttributeValue `json:"attributes"`
	CreatedAt  time.Time      `json:"created_at"`
	UpdatedAt  time.Time      `json:"updated_at"`
}

Message ...

type MessageDelivery added in v0.0.17

type MessageDelivery struct {
	Id                 int64         `json:"id"`
	Message            Message       `json:"message"`
	MessageId          int64         `json:"message_id"`
	Address            string        `json:"address"`
	Status             MessageStatus `json:"status"`
	ErrorMessageStatus *string       `json:"error_message_status"`
	ErrorMessageBody   *string       `json:"error_message_body"`
	CreatedAt          time.Time     `json:"created_at"`
	UpdatedAt          time.Time     `json:"updated_at"`
}

MessageDelivery ...

type MessagePayload added in v0.5.0

type MessagePayload struct {
	AttributeSignature Attributes `json:"attribute_signature"`
}

MessagePayload ...

type MessageStatus added in v0.0.17

type MessageStatus string

MessageStatus ...

type MessageType added in v0.0.17

type MessageType string

MessageType ...

type Metric added in v0.5.0

type Metric struct {
	Id          int64             `json:"id"`
	Name        string            `json:"name" validate:"max=254;required"`
	Description string            `json:"description" validate:"max=254"`
	Options     MetricOptions     `json:"options"`
	Data        []MetricDataItem  `json:"data"`
	Type        common.MetricType `json:"type" validate:"required"`
	Ranges      []string          `json:"ranges"`
	UpdatedAt   time.Time         `json:"updated_at"`
	CreatedAt   time.Time         `json:"created_at"`
}

Metric ...

func (*Metric) RangesByType added in v0.5.0

func (d *Metric) RangesByType() []string

RangesByType ...

type MetricDataItem added in v0.5.0

type MetricDataItem struct {
	Value    json.RawMessage `json:"value"`
	Metric   *Metric         `json:"metric"`
	MetricId int64           `json:"metric_id"`
	Time     time.Time       `json:"time"`
}

MetricDataItem ...

type MetricOptions added in v0.5.0

type MetricOptions struct {
	Items []MetricOptionsItem `json:"items"`
}

MetricOptions ...

type MetricOptionsItem added in v0.5.0

type MetricOptionsItem struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Color       string `json:"color"`
	Translate   string `json:"translate"`
	Label       string `json:"label"`
}

MetricOptionsItem ...

type NewNotifrMessage added in v0.0.17

type NewNotifrMessage struct {
	Type         string                 `json:"type"`
	BodyType     string                 `json:"body_type"`
	EmailFrom    *string                `json:"email_from"`
	EmailSubject *string                `json:"email_subject"`
	EmailBody    *string                `json:"email_body"`
	Template     *string                `json:"template"`
	SmsText      *string                `json:"sms_text"`
	SlackText    *string                `json:"slack_text"`
	TelegramText *string                `json:"telegram_text"`
	Params       map[string]interface{} `json:"params"`
	Address      string                 `json:"address"`
}

NewNotifrMessage ...

type Permission

type Permission struct {
	Id          int64  `json:"id"`
	RoleName    string `json:"role_name"`
	PackageName string `json:"package_name"`
	LevelName   string `json:"level_name"`
}

Permission ...

type Plugin added in v0.5.0

type Plugin struct {
	Name     string     `json:"name"`
	Version  string     `json:"version"`
	Enabled  bool       `json:"enabled"`
	System   bool       `json:"system"`
	Actor    bool       `json:"actor"`
	Settings Attributes `json:"settings"`
}

Plugin ...

type PluginOptions added in v0.5.0

type PluginOptions struct {
	Triggers           bool                         `json:"triggers"`
	Actors             bool                         `json:"actors"`
	ActorCustomAttrs   bool                         `json:"actor_custom_attrs"`
	ActorAttrs         Attributes                   `json:"actor_attrs"`
	ActorCustomActions bool                         `json:"actor_custom_actions"`
	ActorActions       map[string]EntityActionShort `json:"actor_actions"`
	ActorCustomStates  bool                         `json:"actor_custom_states"`
	ActorStates        map[string]EntityStateShort  `json:"actor_states"`
	ActorCustomSetts   bool                         `json:"actor_custom_setts"`
	ActorSetts         Attributes                   `json:"actor_setts"`
	Setts              Attributes                   `json:"setts"`
}

PluginOptions ...

type PluginSettings added in v0.5.0

type PluginSettings struct {
	Settings Attributes `json:"settings"`
}

PluginSettings ...

type Plugins added in v0.5.2

type Plugins []*Plugin

Plugins ...

func (Plugins) Len added in v0.5.2

func (i Plugins) Len() int

Len ...

func (Plugins) Less added in v0.5.2

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

Less ...

func (Plugins) Swap added in v0.5.2

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

Swap ...

type RegionInfo added in v0.5.0

type RegionInfo struct {
	Ip                 string  `json:"ip"`
	Version            string  `json:"version"`
	City               string  `json:"city"`
	Region             string  `json:"region"`
	RegionCode         string  `json:"region_code"`
	Country            string  `json:"country"`
	CountryName        string  `json:"country_name"`
	CountryCode        string  `json:"country_code"`
	CountryCodeIso3    string  `json:"country_code_iso3"`
	CountryCapital     string  `json:"country_capital"`
	CountryTld         string  `json:"country_tld"`
	ContinentCode      string  `json:"continent_code"`
	InEu               bool    `json:"in_eu"`
	Postal             string  `json:"postal"`
	Latitude           float64 `json:"latitude"`
	Longitude          float64 `json:"longitude"`
	Timezone           string  `json:"timezone"`
	UtcOffset          string  `json:"utc_offset"`
	CountryCallingCode string  `json:"country_calling_code"`
	Currency           string  `json:"currency"`
	CurrencyName       string  `json:"currency_name"`
	Languages          string  `json:"languages"`
	CountryArea        float64 `json:"country_area"`
	CountryPopulation  float64 `json:"country_population"`
	Asn                string  `json:"asn"`
	Org                string  `json:"org"`
}

"ip": "xxx.xxx.xxx.xxx", "version": "IPv4", "city": "Novosibirsk", "region": "Novosibirsk Oblast", "region_code": "NVS", "country": "RU", "country_name": "Russia", "country_code": "RU", "country_code_iso3": "RUS", "country_capital": "Moscow", "country_tld": ".ru", "continent_code": "EU", "in_eu": false, "postal": "630009", "latitude": 54.9022, "longitude": 83.0335, "timezone": "Asia/Novosibirsk", "utc_offset": "+0700", "country_calling_code": "+7", "currency": "RUB", "currency_name": "Ruble", "languages": "ru,tt,xal,cau,ady,kv,ce,tyv,cv,udm,tut,mns,bua,myv,mdf,chm,ba,inh,tut,kbd,krc,av,sah,nog", "country_area": 17100000.0, "country_population": 144478050.0, "asn": "AS31200", "org": "Novotelecom Ltd"

type Role

type Role struct {
	Name        string              `json:"name" validate:"max=254,required"`
	Description string              `json:"description"`
	Parent      *Role               `json:"parent"`
	Children    []*Role             `json:"children"`
	AccessList  map[string][]string `json:"access_list"`
	CreatedAt   time.Time           `json:"created_at"`
	UpdatedAt   time.Time           `json:"updated_at"`
}

Role ...

type RunHistory added in v0.5.0

type RunHistory []RunStory

RunHistory ...

type RunStory added in v0.5.0

type RunStory struct {
	Id    int64      `json:"id"`
	Start time.Time  `json:"start"`
	End   *time.Time `json:"end"`
}

RunStory ...

type Script

type Script struct {
	Id          int64      `json:"id"`
	Lang        ScriptLang `json:"lang" validate:"required"`
	Name        string     `json:"name" validate:"max=254,required"`
	Source      string     `json:"source"`
	Description string     `json:"description"`
	Compiled    string     `json:"-"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
}

Script ...

type SortMapElement

type SortMapElement struct {
	Id     int64 `json:"id"`
	Weight int64 `json:"weight"`
}

SortMapElement ...

type SortMapElementByWeight

type SortMapElementByWeight []*MapElement

SortMapElementByWeight ...

func (SortMapElementByWeight) Len

func (l SortMapElementByWeight) Len() int

Len ...

func (SortMapElementByWeight) Less

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

Less ...

func (SortMapElementByWeight) Swap

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

Swap ...

type SortMapLayer

type SortMapLayer struct {
	Id     int64 `json:"id"`
	Weight int64 `json:"weight"`
}

SortMapLayer ...

type SortMapLayersByWeight

type SortMapLayersByWeight []*MapLayer

SortMapLayersByWeight ...

func (SortMapLayersByWeight) Len

func (l SortMapLayersByWeight) Len() int

Len ...

func (SortMapLayersByWeight) Less

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

Less ...

func (SortMapLayersByWeight) Swap

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

Swap ...

type Storage added in v0.4.0

type Storage struct {
	Name      string          `json:"name"`
	Value     json.RawMessage `json:"value"`
	Changed   bool            `json:"changed"`
	UpdatedAt time.Time       `json:"updated_at"`
	CreatedAt time.Time       `json:"created_at"`
}

Storage...

type Task added in v0.5.0

type Task struct {
	Id          int64                `json:"id"`
	Name        string               `json:"name" validate:"required,lte=255"`
	Description string               `json:"description" validate:"lte=255"`
	Enabled     bool                 `json:"enabled"`
	Condition   common.ConditionType `json:"condition" validate:"required,oneof=or and"`
	Triggers    []*Trigger           `json:"triggers" validate:"dive"`
	Conditions  []*Condition         `json:"conditions" validate:"dive"`
	Actions     []*Action            `json:"actions" validate:"dive"`
	Area        *Area                `json:"area"`
	CreatedAt   time.Time            `json:"created_at"`
	UpdatedAt   time.Time            `json:"updated_at"`
}

Task ...

func (*Task) AddAction added in v0.5.0

func (t *Task) AddAction(a *Action)

AddAction ...

func (*Task) AddCondition added in v0.5.0

func (t *Task) AddCondition(c *Condition)

AddCondition ...

func (*Task) AddTrigger added in v0.5.0

func (t *Task) AddTrigger(tr *Trigger)

AddTrigger ...

type TelegramChat added in v0.5.0

type TelegramChat struct {
	EntityId  common.EntityId
	ChatId    int64
	Username  string
	CreatedAt time.Time
}

TelegramChat ...

type Template added in v0.0.17

type Template struct {
	Validity
	Name         string         `json:"name" validate:"required,max=64" `
	Description  string         `json:"description"`
	Content      string         `json:"content"`
	Status       TemplateStatus `json:"status" validate:"required,max=64"`
	Type         TemplateType   `json:"type" validate:"required,max=64"`
	ParentsCount int            `json:"parents_count"`
	ParentName   *string        `json:"parent"`
	Markers      []string       `json:"markers"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
}

Template ...

func (*Template) GetMarkers added in v0.0.17

func (i *Template) GetMarkers(items []*Template, template *TemplateContent) (markers []string, err error)

GetMarkers ...

func (*Template) GetTemplate added in v0.0.17

func (i *Template) GetTemplate() (tpl *TemplateContent, err error)

GetTemplate ...

type TemplateContent added in v0.0.17

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

TemplateContent ...

type TemplateField added in v0.0.17

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

TemplateField ...

type TemplateRender added in v0.0.17

type TemplateRender struct {
	Subject string `json:"subject"`
	Body    string `json:"body"`
}

TemplateRender ...

func RenderTemplate added in v0.0.17

func RenderTemplate(items []*Template, template *TemplateContent, params map[string]interface{}) (render *TemplateRender, err error)

RenderTemplate ...

type TemplateStatus added in v0.0.17

type TemplateStatus string

TemplateStatus ...

func (TemplateStatus) String added in v0.0.17

func (s TemplateStatus) String() string

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

TemplateTree ...

type TemplateType added in v0.0.17

type TemplateType string

TemplateType ...

func (TemplateType) String added in v0.0.17

func (t TemplateType) String() string

String ...

type Templates added in v0.0.17

type Templates []*Template

Templates ...

func (Templates) Len added in v0.0.17

func (i Templates) Len() int

Len ...

func (Templates) Less added in v0.0.17

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

Less ...

func (Templates) Swap added in v0.0.17

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

Swap ...

type Trigger added in v0.5.0

type Trigger struct {
	Id         int64            `json:"id"`
	Name       string           `json:"name" validate:"required,lte=255"`
	TaskId     int64            `json:"task_id"`
	Entity     *Entity          `json:"entity"`
	EntityId   *common.EntityId `json:"entity_id"`
	Script     *Script          `json:"script"`
	ScriptId   int64            `json:"script_id" validate:"required"`
	PluginName string           `json:"plugin_name" validate:"required,lte=255"`
	Payload    Attributes       `json:"payload"`
}

Trigger ...

type TriggerPayload added in v0.5.0

type TriggerPayload struct {
	Obj Attributes `json:"obj"`
}

TriggerPayload ...

type User

type User struct {
	Id                  int64          `json:"id"`
	Nickname            string         `json:"nickname" validate:"required,min=3,max=255"`
	FirstName           string         `json:"first_name" validate:"max=255"`
	LastName            string         `json:"last_name" validate:"max=255"`
	EncryptedPassword   string         `json:"encrypted_password,omitempty"`
	Email               string         `json:"email" validate:"required,email"`
	Status              string         `json:"status" validate:"max=255"`
	ResetPasswordToken  string         `json:"-,omitempty"`
	AuthenticationToken *string        `json:"authentication_token,omitempty"`
	Image               *Image         `json:"image,omitempty"`
	ImageId             sql.NullInt64  `json:"image_id"`
	SignInCount         int64          `json:"sign_in_count,omitempty"`
	CurrentSignInIp     string         `json:"current_sign_in_ip,omitempty"`
	LastSignInIp        string         `json:"last_sign_in_ip,omitempty"`
	Lang                string         `json:"lang"`
	User                *User          `json:"user,omitempty"`
	UserId              sql.NullInt64  `json:"user_id"`
	Role                *Role          `json:"role"`
	RoleName            string         `json:"role_name,omitempty"`
	Meta                []*UserMeta    `json:"meta,omitempty"`
	ResetPasswordSentAt *time.Time     `json:"reset_password_sent_at,omitempty"`
	CurrentSignInAt     *time.Time     `json:"current_sign_in_at,omitempty"`
	LastSignInAt        *time.Time     `json:"last_sign_in_at,omitempty"`
	CreatedAt           time.Time      `json:"created_at,omitempty"`
	UpdatedAt           time.Time      `json:"updated_at,omitempty"`
	DeletedAt           *time.Time     `json:"deleted_at"`
	History             []*UserHistory `json:"history,omitempty"`
}

User ...

func (User) CheckPass

func (u User) CheckPass(password string) (ok bool)

CheckPass ...

func (*User) SetPass

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

SetPass ...

func (*User) UpdateHistory

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

UpdateHistory ...

type UserHistory

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

UserHistory ...

type UserMeta

type UserMeta struct {
	Id     int64  `json:"id"`
	User   *User  `json:"user"`
	UserId int64  `json:"user_id"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

UserMeta ...

type Validity added in v0.0.17

type Validity struct {
}

Validity ...

type Variable

type Variable struct {
	Name      string           `json:"name"`
	Value     string           `json:"value"`
	Autoload  bool             `json:"autoload"`
	EntityId  *common.EntityId `json:"entity_id"`
	CreatedAt time.Time        `json:"created_at"`
	UpdatedAt time.Time        `json:"updated_at"`
}

Variable ...

func NewVariable added in v0.0.9

func NewVariable(name string) Variable

NewVariable ...

func (*Variable) GetObj added in v0.0.9

func (v *Variable) GetObj(obj interface{}) (err error)

GetObj ...

func (*Variable) SetObj added in v0.0.9

func (v *Variable) SetObj(obj interface{}) (err error)

SetObj ...

type Version added in v0.0.24

type Version struct {
	Version     string `json:"version"`
	Revision    string `json:"revision"`
	RevisionURL string `json:"revision_url"`
	Generated   string `json:"generated"`
	Developers  string `json:"developers"`
	BuildNum    string `json:"build_num"`
	DockerImage string `json:"docker_image"`
}

Version ...

type Zigbee2mqtt added in v0.1.0

type Zigbee2mqtt struct {
	Id                int64                `json:"id"`
	Name              string               `json:"name" validate:"required,max=254"`
	Login             string               `json:"login"`
	Password          *string              `json:"password"`
	EncryptedPassword string               `json:"encrypted_password"`
	Devices           []*Zigbee2mqttDevice `json:"devices"`
	PermitJoin        bool                 `json:"permit_join"`
	BaseTopic         string               `json:"base_topic"`
	CreatedAt         time.Time            `json:"created_at"`
	UpdatedAt         time.Time            `json:"updated_at"`
}

Zigbee2mqtt ...

type Zigbee2mqttDevice added in v0.1.0

type Zigbee2mqttDevice struct {
	Id            string    `json:"id"`
	Zigbee2mqttId int64     `json:"zigbee2mqtt_id" validate:"required"`
	Name          string    `json:"name" validate:"required,max=254"`
	Type          string    `json:"type"`
	Model         string    `json:"model"`
	Description   string    `json:"description"`
	Manufacturer  string    `json:"manufacturer"`
	Functions     []string  `json:"functions"`
	ImageUrl      string    `json:"image_url"`
	Status        string    `json:"status"`
	Payload       []byte    `json:"payload"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Zigbee2mqttDevice ...

func (*Zigbee2mqttDevice) GetImageUrl added in v0.1.0

func (d *Zigbee2mqttDevice) GetImageUrl()

GetImageUrl ...

Jump to

Keyboard shortcuts

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