Documentation ¶
Index ¶
- Constants
- func Attach(ctx context.Context, db db.DB, cleaners ...func(key string, obj interface{})) store.Store
- func CreateData(db db.DB, tbName string, data map[string]interface{}) (int64, error)
- func FormatMeasureName(deviceID int64, tagName string) string
- func IsDataExists(db db.DB, tbName string, cond string, params ...interface{}) (bool, error)
- func LoadData(db db.DB, tbName string, data map[string]interface{}, cond string, ...) error
- func New() store.Store
- func RemoveData(db db.DB, tbName string, cond string, params ...interface{}) error
- func SaveData(db db.DB, tbName string, data map[string]interface{}, cond string, ...) error
- type Alarm
- func (alarm *Alarm) Brief() model.Map
- func (alarm *Alarm) Confirm(data map[string]interface{}) error
- func (alarm *Alarm) CreatedAt() time.Time
- func (alarm *Alarm) Destroy() error
- func (alarm *Alarm) Detail() model.Map
- func (alarm *Alarm) Device() (model.Device, error)
- func (alarm *Alarm) DeviceID() int64
- func (alarm *Alarm) GetID() int64
- func (alarm *Alarm) GetOption(path string) gjson.Result
- func (alarm *Alarm) Measure() (model.Measure, error)
- func (alarm *Alarm) MeasureID() int64
- func (alarm *Alarm) Option() map[string]interface{}
- func (alarm *Alarm) Save() error
- func (alarm *Alarm) SetOption(path string, value interface{}) error
- func (alarm *Alarm) Simple() model.Map
- func (alarm *Alarm) Status() (int, string)
- func (alarm *Alarm) Updated()
- func (alarm *Alarm) UpdatedAt() time.Time
- type ApiResource
- func (res *ApiResource) Desc() string
- func (res *ApiResource) GetChildrenResources(options ...helper.OptionFN) ([]model.Resource, int64, error)
- func (res *ApiResource) GetID() int64
- func (res *ApiResource) OrganizationID() int64
- func (res *ApiResource) ResourceClass() resource.Class
- func (res *ApiResource) ResourceDesc() string
- func (res *ApiResource) ResourceID() int64
- func (res *ApiResource) ResourceTitle() string
- func (res *ApiResource) Title() string
- type Comment
- func (c *Comment) Alarm() (model.Alarm, error)
- func (c *Comment) AlarmID() int64
- func (c *Comment) Brief() model.Map
- func (c *Comment) CreatedAt() time.Time
- func (c *Comment) Destroy() error
- func (c *Comment) Detail() model.Map
- func (c *Comment) GetID() int64
- func (c *Comment) GetOption(path string) gjson.Result
- func (c *Comment) GetReplyList(options ...helper.OptionFN) ([]model.Comment, int64, error)
- func (c *Comment) Option() map[string]interface{}
- func (c *Comment) Parent() (model.Comment, error)
- func (c *Comment) ParentID() int64
- func (c *Comment) Save() error
- func (c *Comment) SetAlarmID(id int64)
- func (c *Comment) SetOption(path string, value interface{}) error
- func (c *Comment) SetParentID(id int64)
- func (c *Comment) SetUserID(id int64)
- func (c *Comment) Simple() model.Map
- func (c *Comment) User() (model.User, error)
- func (c *Comment) UserID() int64
- type Config
- func (config *Config) CreatedAt() time.Time
- func (config *Config) Destroy() error
- func (config *Config) GetID() int64
- func (config *Config) GetOption(key string) gjson.Result
- func (config *Config) Name() string
- func (config *Config) Option() map[string]interface{}
- func (config *Config) Save() error
- func (config *Config) SetOption(key string, value interface{}) error
- func (config *Config) UpdateAt() time.Time
- type Device
- func (d *Device) Brief() model.Map
- func (d *Device) CreateMeasure(title string, tag string, kind resource.MeasureKind) (model.Measure, error)
- func (d *Device) CreatedAt() time.Time
- func (d *Device) Destroy() error
- func (d *Device) Detail() model.Map
- func (d *Device) Disable()
- func (d *Device) Enable()
- func (d *Device) GetChildrenResources(options ...helper.OptionFN) ([]model.Resource, int64, error)
- func (d *Device) GetID() int64
- func (d *Device) GetMeasureList(options ...helper.OptionFN) ([]model.Measure, int64, error)
- func (d *Device) GetOption(key string) gjson.Result
- func (d *Device) Groups() ([]model.Group, error)
- func (d *Device) IsEnabled() bool
- func (d *Device) Logger() *log.Entry
- func (d *Device) Option() map[string]interface{}
- func (d *Device) Organization() (model.Organization, error)
- func (d *Device) OrganizationID() int64
- func (d *Device) ResourceClass() resource.Class
- func (d *Device) ResourceDesc() string
- func (d *Device) ResourceID() int64
- func (d *Device) ResourceTitle() string
- func (d *Device) Save() error
- func (d *Device) SetGroups(groups ...interface{}) error
- func (d *Device) SetOption(key string, value interface{}) error
- func (d *Device) SetTitle(title string)
- func (d *Device) Simple() model.Map
- func (d *Device) Title() string
- func (d *Device) UID() string
- type Equipment
- func (e *Equipment) Brief() model.Map
- func (e *Equipment) CreateState(title, desc string, measure interface{}, extra map[string]interface{}) (model.State, error)
- func (e *Equipment) CreatedAt() time.Time
- func (e *Equipment) Desc() string
- func (e *Equipment) Destroy() error
- func (e *Equipment) Detail() model.Map
- func (e *Equipment) Disable()
- func (e *Equipment) Enable()
- func (e *Equipment) GetChildrenResources(options ...helper.OptionFN) ([]model.Resource, int64, error)
- func (e *Equipment) GetID() int64
- func (e *Equipment) GetStateList(options ...helper.OptionFN) ([]model.State, int64, error)
- func (e *Equipment) Groups() ([]model.Group, error)
- func (e *Equipment) IsEnabled() bool
- func (e *Equipment) Logger() *log.Entry
- func (e *Equipment) Organization() (model.Organization, error)
- func (e *Equipment) OrganizationID() int64
- func (e *Equipment) ResourceClass() resource.Class
- func (e *Equipment) ResourceDesc() string
- func (e *Equipment) ResourceID() int64
- func (e *Equipment) ResourceTitle() string
- func (e *Equipment) Save() error
- func (e *Equipment) SetDesc(desc string)
- func (e *Equipment) SetGroups(groups ...interface{}) error
- func (e *Equipment) SetTitle(title string)
- func (e *Equipment) Simple() model.Map
- func (e *Equipment) Title() string
- func (e *Equipment) UID() string
- type Group
- func (g *Group) AddDevice(devices ...interface{}) error
- func (g *Group) AddEquipment(equipments ...interface{}) error
- func (g *Group) Brief() model.Map
- func (g *Group) CreatedAt() time.Time
- func (g *Group) Desc() string
- func (g *Group) Destroy() error
- func (g *Group) Detail() model.Map
- func (g *Group) GetChildrenResources(options ...helper.OptionFN) ([]model.Resource, int64, error)
- func (g *Group) GetDeviceList(options ...helper.OptionFN) ([]model.Device, int64, error)
- func (g *Group) GetEquipmentList(options ...helper.OptionFN) ([]model.Equipment, int64, error)
- func (g *Group) GetID() int64
- func (g *Group) Organization() (model.Organization, error)
- func (g *Group) OrganizationID() int64
- func (g *Group) Parent() model.Group
- func (g *Group) RemoveDevice(devices ...interface{}) error
- func (g *Group) RemoveEquipment(equipments ...interface{}) error
- func (g *Group) ResourceClass() resource.Class
- func (g *Group) ResourceDesc() string
- func (g *Group) ResourceID() int64
- func (g *Group) ResourceTitle() string
- func (g *Group) Save() error
- func (g *Group) SetDesc(desc string)
- func (g *Group) SetParent(parent interface{})
- func (g *Group) SetTitle(title string)
- func (g *Group) Simple() model.Map
- func (g *Group) Title() string
- type Measure
- func (m *Measure) Brief() model.Map
- func (m *Measure) CreatedAt() time.Time
- func (m *Measure) Destroy() error
- func (m *Measure) Detail() model.Map
- func (m *Measure) Device() model.Device
- func (m *Measure) Disable()
- func (m *Measure) Enable()
- func (m *Measure) GetChildrenResources(options ...helper.OptionFN) ([]model.Resource, int64, error)
- func (m *Measure) GetID() int64
- func (m *Measure) IsEnabled() bool
- func (m *Measure) Kind() resource.MeasureKind
- func (m *Measure) Name() string
- func (m *Measure) OrganizationID() int64
- func (m *Measure) ResourceClass() resource.Class
- func (m *Measure) ResourceDesc() string
- func (m *Measure) ResourceID() int64
- func (m *Measure) ResourceTitle() string
- func (m *Measure) Save() error
- func (m *Measure) SetTitle(title string)
- func (m *Measure) Simple() model.Map
- func (m *Measure) TagName() string
- func (m *Measure) Title() string
- type Organization
- func (o *Organization) Brief() model.Map
- func (o *Organization) CreatedAt() time.Time
- func (o *Organization) Destroy() error
- func (o *Organization) Detail() model.Map
- func (o *Organization) Disable()
- func (o *Organization) Enable()
- func (o *Organization) GetID() int64
- func (o *Organization) GetOption(path string) gjson.Result
- func (o *Organization) IsEnabled() bool
- func (o *Organization) Name() string
- func (o *Organization) Option() map[string]interface{}
- func (o *Organization) Save() error
- func (o *Organization) SetOption(path string, value interface{}) error
- func (o *Organization) SetTitle(title string)
- func (o *Organization) Simple() model.Map
- func (o *Organization) Title() string
- type Policy
- func (p *Policy) Action() resource.Action
- func (p *Policy) Brief() model.Map
- func (p *Policy) CreatedAt() time.Time
- func (p *Policy) Destroy() error
- func (p *Policy) Detail() model.Map
- func (p *Policy) Effect() resource.Effect
- func (p *Policy) GetID() int64
- func (p *Policy) Resource() model.Resource
- func (p *Policy) Role() model.Role
- func (p *Policy) Save() error
- func (p *Policy) SetEffect(effect resource.Effect)
- func (p *Policy) Simple() model.Map
- type Role
- func (r *Role) Brief() model.Map
- func (r *Role) CreatedAt() time.Time
- func (r *Role) Desc() string
- func (r *Role) Destroy() error
- func (r *Role) Detail() model.Map
- func (r *Role) Disable()
- func (r *Role) Enable()
- func (r *Role) GetID() int64
- func (r *Role) GetPolicy(res model.Resource) (map[resource.Action]model.Policy, error)
- func (r *Role) GetUserList(options ...helper.OptionFN) ([]model.User, int64, error)
- func (r *Role) IsAllow(res model.Resource, action resource.Action) (bool, error)
- func (r *Role) IsEnabled() bool
- func (r *Role) Name() string
- func (r *Role) Organization() (model.Organization, error)
- func (r *Role) OrganizationID() int64
- func (r *Role) RemovePolicy(res model.Resource) error
- func (r *Role) Save() error
- func (r *Role) SetDesc(desc string)
- func (r *Role) SetPolicy(res model.Resource, action resource.Action, effect resource.Effect, ...) (model.Policy, error)
- func (r *Role) SetTitle(title string)
- func (r *Role) Simple() model.Map
- func (r *Role) Title() string
- type State
- func (s *State) AlarmDeadBand() float32
- func (s *State) AlarmDelaySecond() int
- func (s *State) Brief() model.Map
- func (s *State) CreatedAt() time.Time
- func (s *State) Desc() string
- func (s *State) Destroy() error
- func (s *State) Detail() model.Map
- func (s *State) Disable()
- func (s *State) DisableAlarm()
- func (s *State) DisableAlarmEntry(name string)
- func (s *State) Enable()
- func (s *State) EnableAlarm()
- func (s *State) EnableAlarmEntry(name string)
- func (s *State) Equipment() model.Equipment
- func (s *State) GetAlarmEntries() map[string]float32
- func (s *State) GetAlarmEntry(name string) (float32, bool)
- func (s *State) GetChildrenResources(options ...helper.OptionFN) ([]model.Resource, int64, error)
- func (s *State) GetID() int64
- func (s *State) GetOption(path string) gjson.Result
- func (s *State) IsAlarmEnabled() bool
- func (s *State) IsEnabled() bool
- func (s *State) Measure() model.Measure
- func (s *State) Option() map[string]interface{}
- func (s *State) OrganizationID() int64
- func (s *State) ResourceClass() resource.Class
- func (s *State) ResourceDesc() string
- func (s *State) ResourceID() int64
- func (s *State) ResourceTitle() string
- func (s *State) Save() error
- func (s *State) SetAlarmDeadBand(v float32)
- func (s *State) SetAlarmDelay(seconds int)
- func (s *State) SetAlarmEntry(name string, value float32)
- func (s *State) SetDesc(desc string)
- func (s *State) SetMeasure(measure interface{})
- func (s *State) SetOption(path string, value interface{}) error
- func (s *State) SetTitle(title string)
- func (s *State) Simple() model.Map
- func (s *State) Title() string
- type User
- func (u *User) Brief() model.Map
- func (u *User) CheckPassword(password string) bool
- func (u *User) CreatedAt() time.Time
- func (u *User) Destroy() error
- func (u *User) Detail() model.Map
- func (u *User) Disable()
- func (u *User) Email() string
- func (u *User) Enable()
- func (u *User) GetID() int64
- func (u *User) GetRoles() ([]model.Role, error)
- func (u *User) Is(role interface{}) (bool, error)
- func (u *User) IsAllow(res model.Resource, action resource.Action) (bool, error)
- func (u *User) IsEnabled() bool
- func (u *User) Logger() *log.Entry
- func (u *User) Mobile() string
- func (u *User) Name() string
- func (u *User) Organization() (model.Organization, error)
- func (u *User) OrganizationID() int64
- func (u *User) RemovePolicies(res model.Resource) error
- func (u *User) ResetPassword(password string)
- func (u *User) Save() error
- func (u *User) SetAllow(res model.Resource, actions ...resource.Action) error
- func (u *User) SetDeny(res model.Resource, actions ...resource.Action) error
- func (u *User) SetRoles(roles ...interface{}) error
- func (u *User) Simple() model.Map
- func (u *User) Title() string
- func (u *User) UID() string
- func (u *User) Update(profile model.Map)
Constants ¶
View Source
const ( TbConfig = "`config`" TbOrganization = "`organizations`" TbUsers = "`users`" TbRoles = "`roles`" TbUserRoles = "`user_roles`" TbPolicies = "`policies`" TbGroups = "`groups`" TbDevices = "`devices`" TbMeasures = "`measures`" TbDeviceGroups = "`device_groups`" TbEquipments = "`equipments`" TbStates = "`states`" TbEquipmentGroups = "`equipment_groups`" TbApiResources = "`api_resources`" TbAlarms = "`alarms`" TbComments = "`comments`" )
Variables ¶
This section is empty.
Functions ¶
func CreateData ¶
func FormatMeasureName ¶
func IsDataExists ¶
func RemoveData ¶
Types ¶
type ApiResource ¶
type ApiResource struct {
// contains filtered or unexported fields
}
func NewApiResource ¶
func NewApiResource(store *mysqlStore, id int64) *ApiResource
func (*ApiResource) Desc ¶
func (res *ApiResource) Desc() string
func (*ApiResource) GetChildrenResources ¶
func (*ApiResource) GetID ¶
func (res *ApiResource) GetID() int64
func (*ApiResource) OrganizationID ¶
func (res *ApiResource) OrganizationID() int64
func (*ApiResource) ResourceClass ¶
func (res *ApiResource) ResourceClass() resource.Class
func (*ApiResource) ResourceDesc ¶
func (res *ApiResource) ResourceDesc() string
func (*ApiResource) ResourceID ¶
func (res *ApiResource) ResourceID() int64
func (*ApiResource) ResourceTitle ¶
func (res *ApiResource) ResourceTitle() string
func (*ApiResource) Title ¶
func (res *ApiResource) Title() string
type Comment ¶
type Comment struct {
// contains filtered or unexported fields
}
func NewComment ¶
func (*Comment) GetReplyList ¶
func (*Comment) SetAlarmID ¶
func (*Comment) SetParentID ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func NewDDevice ¶
func (*Device) CreateMeasure ¶
func (*Device) GetChildrenResources ¶
func (*Device) GetMeasureList ¶
func (*Device) Organization ¶
func (d *Device) Organization() (model.Organization, error)
func (*Device) OrganizationID ¶
func (*Device) ResourceClass ¶
func (*Device) ResourceDesc ¶
func (*Device) ResourceID ¶
func (*Device) ResourceTitle ¶
type Equipment ¶
type Equipment struct {
// contains filtered or unexported fields
}
func NewEquipment ¶
func (*Equipment) CreateState ¶
func (*Equipment) GetChildrenResources ¶
func (*Equipment) GetStateList ¶
func (*Equipment) Organization ¶
func (e *Equipment) Organization() (model.Organization, error)
func (*Equipment) OrganizationID ¶
func (*Equipment) ResourceClass ¶
func (*Equipment) ResourceDesc ¶
func (*Equipment) ResourceID ¶
func (*Equipment) ResourceTitle ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func (*Group) AddEquipment ¶
func (*Group) GetChildrenResources ¶
func (*Group) GetDeviceList ¶
func (*Group) GetEquipmentList ¶
func (*Group) Organization ¶
func (g *Group) Organization() (model.Organization, error)
func (*Group) OrganizationID ¶
func (*Group) RemoveDevice ¶
func (*Group) RemoveEquipment ¶
func (*Group) ResourceClass ¶
func (*Group) ResourceDesc ¶
func (*Group) ResourceID ¶
func (*Group) ResourceTitle ¶
type Measure ¶
type Measure struct {
// contains filtered or unexported fields
}
func NewMeasure ¶
func (*Measure) GetChildrenResources ¶
func (*Measure) Kind ¶
func (m *Measure) Kind() resource.MeasureKind
func (*Measure) OrganizationID ¶
func (*Measure) ResourceClass ¶
func (*Measure) ResourceDesc ¶
func (*Measure) ResourceID ¶
func (*Measure) ResourceTitle ¶
type Organization ¶
type Organization struct {
// contains filtered or unexported fields
}
func NewOrganization ¶
func NewOrganization(store *mysqlStore, id int64) *Organization
func (*Organization) Brief ¶
func (o *Organization) Brief() model.Map
func (*Organization) CreatedAt ¶
func (o *Organization) CreatedAt() time.Time
func (*Organization) Destroy ¶
func (o *Organization) Destroy() error
func (*Organization) Detail ¶
func (o *Organization) Detail() model.Map
func (*Organization) Disable ¶
func (o *Organization) Disable()
func (*Organization) Enable ¶
func (o *Organization) Enable()
func (*Organization) GetID ¶
func (o *Organization) GetID() int64
func (*Organization) IsEnabled ¶
func (o *Organization) IsEnabled() bool
func (*Organization) Name ¶
func (o *Organization) Name() string
func (*Organization) Option ¶
func (o *Organization) Option() map[string]interface{}
func (*Organization) Save ¶
func (o *Organization) Save() error
func (*Organization) SetOption ¶
func (o *Organization) SetOption(path string, value interface{}) error
func (*Organization) SetTitle ¶
func (o *Organization) SetTitle(title string)
func (*Organization) Simple ¶
func (o *Organization) Simple() model.Map
func (*Organization) Title ¶
func (o *Organization) Title() string
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
func (*Role) GetUserList ¶
func (*Role) Organization ¶
func (r *Role) Organization() (model.Organization, error)
func (*Role) OrganizationID ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) AlarmDeadBand ¶
func (*State) AlarmDelaySecond ¶
func (*State) DisableAlarm ¶
func (s *State) DisableAlarm()
func (*State) DisableAlarmEntry ¶
func (*State) EnableAlarm ¶
func (s *State) EnableAlarm()
func (*State) EnableAlarmEntry ¶
func (*State) GetAlarmEntries ¶
func (*State) GetChildrenResources ¶
func (*State) IsAlarmEnabled ¶
func (*State) OrganizationID ¶
func (*State) ResourceClass ¶
func (*State) ResourceDesc ¶
func (*State) ResourceID ¶
func (*State) ResourceTitle ¶
func (*State) SetAlarmDeadBand ¶
func (*State) SetAlarmDelay ¶
func (*State) SetAlarmEntry ¶
func (*State) SetMeasure ¶
func (s *State) SetMeasure(measure interface{})
type User ¶
type User struct {
// contains filtered or unexported fields
}
func (*User) CheckPassword ¶
func (*User) Organization ¶
func (u *User) Organization() (model.Organization, error)
func (*User) OrganizationID ¶
func (*User) ResetPassword ¶
Click to show internal directories.
Click to hide internal directories.