Documentation
¶
Index ¶
- Constants
- func CoreClient() *core.Client
- func DB() *gorm.DB
- func GenUniqueKey(ruleID uint, entityID string) string
- func GetRedis() *redis.Client
- func InitRedis(addr, password string, db int)
- func Setup() error
- func UpdateEntityRuleInfo(entityID, ruleinfo string, c choice) error
- type Rule
- func (r *Rule) BeforeCreate(tx *gorm.DB) (err error)
- func (r *Rule) BeforeDelete(tx *gorm.DB) (err error)
- func (r *Rule) Exists() (bool, error)
- func (r *Rule) InitMetrics()
- func (r *Rule) SelectFirst() *gorm.DB
- func (r *Rule) Subscribe(id uint, auth string) error
- func (r *Rule) SwitchStatus() error
- func (r *Rule) Unsubscribe() error
- func (s *Rule) UpdateTenantID(userID, tenantID string)
- type RuleEntities
- type Target
Constants ¶
View Source
const ( TypeMessageRule uint8 = iota + 1 TypeTimeseriesRule )
Const for Rule's Type
View Source
const ( StatusNotRunning uint8 = iota StatusRunning )
Const for Rule's Status
View Source
const ( TargetTypeKafka = iota + 1 TargetTypeObjectStorage )
The field for Target type
View Source
const ( KeyRawData = "rawData" KeyTeleMetry = "telemetry" )
The key of the entity properties
View Source
const ( RuleTypeMessage = 1 RuleTypeTimeseries = 2 )
rule type.
View Source
const SubscribeService string = "http://localhost:3500/v1.0/invoke/keel/method/apis/core-broker/v1/subscribe/%d"
View Source
const SubscriptionIDFormat = "%s_%d_%s"
Variables ¶
This section is empty.
Functions ¶
func CoreClient ¶
func GenUniqueKey ¶
func UpdateEntityRuleInfo ¶
Types ¶
type Rule ¶
type Rule struct { // gorm.Model ID uint `gorm:"primarykey"` CreatedAt time.Time UpdatedAt time.Time UserID string `gorm:"index;uniqueIndex:user_rule"` TenantID string ModelID string ModelName string SubID uint SubEndpoint string Name string `gorm:"not null;size:255;uniqueIndex:user_rule"` Status uint8 `gorm:"default:0;comment:'0:not_running,1:running'"` Desc string Type uint8 `gorm:"not null;index;comment:'1:message;2:timeseries'"` SelectExpr string WhereExpr string }
func (*Rule) InitMetrics ¶
func (r *Rule) InitMetrics()
func (*Rule) SelectFirst ¶
func (*Rule) SwitchStatus ¶
func (*Rule) Unsubscribe ¶
func (*Rule) UpdateTenantID ¶
type RuleEntities ¶
type RuleEntities struct { UniqueKey string `gorm:"uniqueIndex;size:255"` RuleID uint EntityID string Rule Rule }
func (*RuleEntities) BeforeCreate ¶
func (e *RuleEntities) BeforeCreate(tx *gorm.DB) error
func (*RuleEntities) BeforeDelete ¶
func (e *RuleEntities) BeforeDelete(tx *gorm.DB) error
func (*RuleEntities) Find ¶
func (e *RuleEntities) Find(tx *gorm.DB) []RuleEntities
func (*RuleEntities) FindEntityIDS ¶
func (e *RuleEntities) FindEntityIDS() []string
type Target ¶
type Target struct { ID uint `gorm:"primaryKey"` Type uint8 `gorm:"not null;index;comment:'1:kafka;2:object-storage'"` Host string Value string Ext *string `gorm:"type:json;null"` RuleID uint Status string `gorm:"column:status"` ConfigStatus bool `gorm:"column:config_status"` // Configuration map[string]interface{} `gorm:"column:configuration"` SinkType string `gorm:"column:sink_type"` SinkId string `gorm:"column:sink_id"` ErrorActionFlag bool `gorm:"column:error_action_flag"` CreateTime int64 `gorm:"column:create_time"` UpdateTime int64 `gorm:"column:update_time"` Rule Rule }
func (*Target) FindAndAuth ¶
Click to show internal directories.
Click to hide internal directories.