Documentation ¶
Index ¶
Constants ¶
View Source
const (
PBehaviorCollectionName = "default_pbehavior"
)
PBehaviorCollectionName is where we store pbehaviors
Variables ¶
This section is empty.
Functions ¶
func DefaultCollection ¶
func DefaultCollection(session *mgo.Session) mongo.Collection
Types ¶
type Adapter ¶
type Adapter interface { // Get read pbehaviors from db Get(bson.M) ([]types.PBehavior, error) // Insert insert pbehavior in db Insert(types.PBehavior) error // Update insert pbehavior in db Update(types.PBehavior) error // RemoveId remove pbehavior from db by id RemoveId(string) error // GetByEntityIds get pbehaviors from db by Entity IDs GetByEntityIds(eids []string, enabled bool) ([]types.PBehavior, error) }
func NewAdapter ¶
func NewAdapter(collection mongo.Collection) Adapter
NewAdapter gives the correct mongo pbehavior adapter.
type Service ¶
type Service interface { // Create declare a new pbheavior Insert(types.PBehavior) error // Get find pbehaviors from db Get(bson.M) ([]types.PBehavior, error) // Remove remove a pbehavior Remove(types.PBehavior) error // AlarmHasPBehavior checks if an alarm has an enabled pbehavior on it. Be // careful, this method does not check if a pbehavior is active. AlarmHasPBehavior(types.Alarm) bool // GetByEntityIds retrieves every pbehaviors on a list of entities GetByEntityIds(eids []string, enabled bool) ([]types.PBehavior, error) // HasActivePBehavior returns true if the entity has an active pbehavior. HasActivePBehavior(entityID string) bool }
Service allows you to manipulate actions.
Click to show internal directories.
Click to hide internal directories.