Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiResource ¶
type Device ¶
type Device interface { DBEntry EnableEntry OptionEntry LogEntry Profile Resource Organization() (Organization, error) Title() string SetTitle(title string) SetGroups(groups ...interface{}) error Groups() ([]Group, error) GetMeasureList(options ...helper.OptionFN) ([]Measure, int64, error) CreateMeasure(title string, tag string, kind resource.MeasureKind) (Measure, error) }
物理设备,网关等
type EnableEntry ¶
type EnableEntry interface { Enable() Disable() IsEnabled() bool }
type Equipment ¶
type Equipment interface { DBEntry EnableEntry LogEntry Profile Resource Organization() (Organization, error) Title() string SetTitle(title string) Desc() string SetDesc(string) SetGroups(groups ...interface{}) error Groups() ([]Group, error) GetStateList(options ...helper.OptionFN) ([]State, int64, error) CreateState(title, desc string, measure interface{}, extra map[string]interface{}) (State, error) }
虚拟设备
type Group ¶
type Group interface { DBEntry Profile Resource Organization() (Organization, error) Parent() Group SetParent(group interface{}) Title() string SetTitle(title string) Desc() string SetDesc(desc string) GetDeviceList(options ...helper.OptionFN) ([]Device, int64, error) AddDevice(devices ...interface{}) error RemoveDevice(devices ...interface{}) error GetEquipmentList(options ...helper.OptionFN) ([]Equipment, int64, error) AddEquipment(equipments ...interface{}) error RemoveEquipment(equipments ...interface{}) error }
设备分组
type Measure ¶
type Measure interface { DBEntry EnableEntry Profile Resource Device() Device Title() string SetTitle(title string) TagName() string Kind() resource.MeasureKind Name() string //for cache }
点位
type OptionEntry ¶
type Organization ¶
type Organization interface { DBEntry EnableEntry OptionEntry Profile Name() string Title() string SetTitle(string) }
type Policy ¶
type Policy interface { DBEntry Profile Role() Role SetEffect(effect resource.Effect) Resource() Resource Action() resource.Action Effect() resource.Effect }
策略
type Role ¶
type Role interface { DBEntry EnableEntry Profile OrganizationID() int64 Name() string Title() string SetTitle(title string) Desc() string SetDesc(desc string) //设置指定资源的对于指定action的effect,传入recursiveMap则对子资源进行递归设置,recursiveMap为nil则只设置当前资源 SetPolicy(res Resource, action resource.Action, effect resource.Effect, recursiveMap map[Resource]struct{}) (Policy, error) //对于每个资源,都应该返回一组Policy,表示对该资源的访问权限 GetPolicy(res Resource) (map[resource.Action]Policy, error) RemovePolicy(res Resource) error IsAllow(res Resource, action resource.Action) (bool, error) GetUserList(options ...helper.OptionFN) ([]User, int64, error) }
角色
type State ¶
type State interface { DBEntry EnableEntry OptionEntry Resource Profile Measure() Measure Equipment() Equipment SetMeasure(measure interface{}) Title() string SetTitle(string) Desc() string SetDesc(string) IsAlarmEnabled() bool EnableAlarm() DisableAlarm() AlarmDeadBand() float32 SetAlarmDeadBand(v float32) AlarmDelaySecond() int SetAlarmDelay(seconds int) GetAlarmEntries() map[string]float32 GetAlarmEntry(name string) (float32, bool) SetAlarmEntry(name string, value float32) EnableAlarmEntry(name string) DisableAlarmEntry(name string) }
虚拟设备点位
type User ¶
type User interface { DBEntry EnableEntry LogEntry Profile OrganizationID() int64 Organization() (Organization, error) Name() string Title() string Mobile() string Email() string ResetPassword(password string) CheckPassword(password string) bool Update(profile Map) SetRoles(roles ...interface{}) error GetRoles() ([]Role, error) Is(role interface{}) (bool, error) SetAllow(res Resource, actions ...resource.Action) error SetDeny(res Resource, actions ...resource.Action) error RemovePolicies(res Resource) error IsAllow(res Resource, action resource.Action) (bool, error) }
用户
Click to show internal directories.
Click to hide internal directories.