rule.go 581 B

1234567891011121314151617181920212223
  1. package models
  2. import (
  3. "github.com/jinzhu/gorm"
  4. )
  5. // Rule rule
  6. // rule is used for automated works such as timers, ifttts.
  7. type Rule struct {
  8. gorm.Model
  9. // which device the rule belongs to
  10. DeviceID int64
  11. // rule type, timmer | ifttt
  12. RuleType string `sql:"type:varchar(20);not null;"`
  13. // which action triggers the rule
  14. Trigger string `sql:"type:varchar(200);not null;"`
  15. // where to send
  16. Target string `sql:"type:varchar(200);not null;"`
  17. // what action to take.
  18. Action string `sql:"type:varchar(200);not null;"`
  19. // if trigger once
  20. Once bool `sql:"default(false)"`
  21. }