Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AnnotationsValueScanner = field.ValueScannerFunc[notification.Annotations, *sql.NullString]{ V: func(annotations notification.Annotations) (driver.Value, error) { b, err := json.Marshal(annotations) if err != nil { return nil, err } return string(b), nil }, S: func(ns *sql.NullString) (notification.Annotations, error) { var annotations notification.Annotations if ns == nil || !ns.Valid { return annotations, nil } if err := json.Unmarshal([]byte(ns.String), &annotations); err != nil { return nil, err } return annotations, nil }, }
View Source
var ChannelConfigValueScanner = field.ValueScannerFunc[notification.ChannelConfig, *sql.NullString]{ V: func(config notification.ChannelConfig) (driver.Value, error) { switch config.Type { case notification.ChannelTypeWebhook: serde := channelConfigSerde[notification.WebHookChannelConfig]{ ChannelConfigMeta: notification.ChannelConfigMeta{ Type: config.Type, }, Data: config.WebHook, } return json.Marshal(serde) default: return nil, fmt.Errorf("unknown channel type: %s", config.Type) } }, S: func(ns *sql.NullString) (notification.ChannelConfig, error) { var channelConfig notification.ChannelConfig if ns == nil || !ns.Valid { return channelConfig, nil } data := []byte(ns.String) var meta notification.ChannelConfigMeta if err := json.Unmarshal(data, &meta); err != nil { return channelConfig, err } switch meta.Type { case notification.ChannelTypeWebhook: serde := channelConfigSerde[notification.WebHookChannelConfig]{ ChannelConfigMeta: notification.ChannelConfigMeta{ Type: meta.Type, }, Data: notification.WebHookChannelConfig{}, } if err := json.Unmarshal(data, &serde); err != nil { return channelConfig, err } channelConfig = notification.ChannelConfig{ ChannelConfigMeta: serde.ChannelConfigMeta, WebHook: serde.Data, } default: return channelConfig, fmt.Errorf("unknown channel type: %s", meta.Type) } return channelConfig, nil }, }
View Source
var RuleConfigValueScanner = field.ValueScannerFunc[notification.RuleConfig, *sql.NullString]{ V: func(config notification.RuleConfig) (driver.Value, error) { switch config.Type { case notification.RuleTypeBalanceThreshold: serde := ruleConfigSerde[notification.BalanceThresholdRuleConfig]{ RuleConfigMeta: notification.RuleConfigMeta{ Type: config.Type, }, Data: config.BalanceThreshold, } return json.Marshal(serde) default: return nil, fmt.Errorf("unknown rule config type: %s", config.Type) } }, S: func(ns *sql.NullString) (notification.RuleConfig, error) { var ruleConfig notification.RuleConfig if ns == nil || !ns.Valid { return ruleConfig, nil } data := []byte(ns.String) var meta notification.RuleConfigMeta if err := json.Unmarshal(data, &meta); err != nil { return ruleConfig, err } switch meta.Type { case notification.RuleTypeBalanceThreshold: serde := ruleConfigSerde[notification.BalanceThresholdRuleConfig]{ RuleConfigMeta: notification.RuleConfigMeta{ Type: meta.Type, }, Data: notification.BalanceThresholdRuleConfig{}, } if err := json.Unmarshal(data, &serde); err != nil { return ruleConfig, err } ruleConfig = notification.RuleConfig{ RuleConfigMeta: serde.RuleConfigMeta, BalanceThreshold: serde.Data, } default: return ruleConfig, fmt.Errorf("unknown rule type: %s", meta.Type) } return ruleConfig, nil }, }
Functions ¶
This section is empty.
Types ¶
type BalanceSnapshot ¶
func (BalanceSnapshot) Edges ¶
func (BalanceSnapshot) Edges() []ent.Edge
func (BalanceSnapshot) Fields ¶
func (BalanceSnapshot) Fields() []ent.Field
func (BalanceSnapshot) Indexes ¶
func (BalanceSnapshot) Indexes() []ent.Index
func (BalanceSnapshot) Mixin ¶
func (BalanceSnapshot) Mixin() []ent.Mixin
type Entitlement ¶
func (Entitlement) Edges ¶
func (Entitlement) Edges() []ent.Edge
func (Entitlement) Fields ¶
func (Entitlement) Fields() []ent.Field
func (Entitlement) Indexes ¶
func (Entitlement) Indexes() []ent.Index
func (Entitlement) Mixin ¶
func (Entitlement) Mixin() []ent.Mixin
type NotificationChannel ¶
func (NotificationChannel) Edges ¶
func (NotificationChannel) Edges() []ent.Edge
func (NotificationChannel) Fields ¶
func (NotificationChannel) Fields() []ent.Field
func (NotificationChannel) Indexes ¶
func (NotificationChannel) Indexes() []ent.Index
func (NotificationChannel) Mixin ¶
func (NotificationChannel) Mixin() []ent.Mixin
type NotificationEvent ¶
func (NotificationEvent) Edges ¶
func (NotificationEvent) Edges() []ent.Edge
func (NotificationEvent) Fields ¶
func (NotificationEvent) Fields() []ent.Field
func (NotificationEvent) Indexes ¶
func (NotificationEvent) Indexes() []ent.Index
func (NotificationEvent) Mixin ¶
func (NotificationEvent) Mixin() []ent.Mixin
type NotificationEventDeliveryStatus ¶
func (NotificationEventDeliveryStatus) Edges ¶
func (NotificationEventDeliveryStatus) Edges() []ent.Edge
func (NotificationEventDeliveryStatus) Fields ¶
func (NotificationEventDeliveryStatus) Fields() []ent.Field
func (NotificationEventDeliveryStatus) Indexes ¶
func (NotificationEventDeliveryStatus) Indexes() []ent.Index
func (NotificationEventDeliveryStatus) Mixin ¶
func (NotificationEventDeliveryStatus) Mixin() []ent.Mixin
type NotificationRule ¶
func (NotificationRule) Edges ¶
func (NotificationRule) Edges() []ent.Edge
func (NotificationRule) Fields ¶
func (NotificationRule) Fields() []ent.Field
func (NotificationRule) Indexes ¶
func (NotificationRule) Indexes() []ent.Index
func (NotificationRule) Mixin ¶
func (NotificationRule) Mixin() []ent.Mixin
type UsageReset ¶
func (UsageReset) Edges ¶
func (UsageReset) Edges() []ent.Edge
func (UsageReset) Fields ¶
func (UsageReset) Fields() []ent.Field
func (UsageReset) Indexes ¶
func (UsageReset) Indexes() []ent.Index
func (UsageReset) Mixin ¶
func (UsageReset) Mixin() []ent.Mixin
Click to show internal directories.
Click to hide internal directories.