Documentation
¶
Index ¶
- Variables
- func NewNotificationMessageHandlerTx(notificationHandler NotificationHandlerTx) libkafka.MessageHandlerTx
- func NewNotificationStoreMessageHandlerTx(notificationStoreTx NotificationStoreTx) libkafka.MessageHandlerTx
- func RunNotificationStoreConsumer(saramaClient libkafka.SaramaClient, db libkv.DB, branch base.Branch, ...) run.Func
- type Notification
- type NotificationAdderTx
- type NotificationFinderTx
- type NotificationGetterTx
- type NotificationHandlerTx
- type NotificationHandlerTxList
- type NotificationMapperTx
- type NotificationMessage
- type NotificationRemoverTx
- type NotificationStoreTx
- type NotificationStreamerTx
- type NotificationStreamerTxFunc
- type NotificationTarget
- type NotificationTargets
- type NotificationType
- type NotificationTypes
Constants ¶
This section is empty.
Variables ¶
View Source
var AvailableNotificationTypes = NotificationTypes{ AccountHitLossLimitNotificationType, AccountHitProfitLimitNotificationType, AgentEscalationNotificationType, BacktestCompletedNotificationType, BacktestFailedNotificationType, BacktestStartedNotificationType, GchatRelevantNotificationType, GoReleaseNotificationType, MantraNotificationType, PendingApprovalNotificationType, SignalNotificationType, TestNotificationType, }
View Source
var DiscordV1SchemaID = cdb.SchemaID{
Group: "core",
Kind: "discord",
Version: "v1",
}
View Source
var NotificationV1SchemaID = cdb.SchemaID{
Group: "core",
Kind: "notification",
Version: "v1",
}
View Source
var TelegramV1SchemaID = cdb.SchemaID{
Group: "core",
Kind: "telegram",
Version: "v1",
}
Functions ¶
func NewNotificationMessageHandlerTx ¶
func NewNotificationMessageHandlerTx( notificationHandler NotificationHandlerTx, ) libkafka.MessageHandlerTx
func NewNotificationStoreMessageHandlerTx ¶
func NewNotificationStoreMessageHandlerTx( notificationStoreTx NotificationStoreTx, ) libkafka.MessageHandlerTx
Types ¶
type Notification ¶
type Notification struct {
base.Object[base.Identifier]
// Type of the notification
Type NotificationType `json:"type"`
// Target of the notification (discord channelName, telegram room ...)
Target *NotificationTarget `json:"target,omitempty"`
// Message of the notification
Message NotificationMessage `json:"message"`
// Metadata carries source-specific fields as opaque key/value pairs
// (e.g. trading producers pack brokerIdentifier/stage/accountIdentifier here).
Metadata map[string]string `json:"metadata,omitempty"`
}
type NotificationAdderTx ¶
type NotificationFinderTx ¶
type NotificationFinderTx interface {
// Find matching trades
Find(
ctx context.Context,
tx libkv.Tx,
match func(notification Notification) bool,
ch chan<- Notification,
) error
}
type NotificationGetterTx ¶
type NotificationGetterTx interface {
// Get notification from store
Get(ctx context.Context, tx libkv.Tx, identifier base.Identifier) (*Notification, error)
}
type NotificationHandlerTx ¶
type NotificationHandlerTx interface {
UpdateNotification(ctx context.Context, tx libkv.Tx, notification Notification) error
DeleteNotification(ctx context.Context, tx libkv.Tx, identifier base.Identifier) error
}
func NotificationHandlerTxFunc ¶
func NotificationHandlerTxFunc( update func(ctx context.Context, tx libkv.Tx, notification Notification) error, delete func(ctx context.Context, tx libkv.Tx, identifier base.Identifier) error, ) NotificationHandlerTx
type NotificationHandlerTxList ¶
type NotificationHandlerTxList []NotificationHandlerTx
func (NotificationHandlerTxList) DeleteNotification ¶
func (c NotificationHandlerTxList) DeleteNotification( ctx context.Context, tx libkv.Tx, identifier base.Identifier, ) error
func (NotificationHandlerTxList) UpdateNotification ¶
func (c NotificationHandlerTxList) UpdateNotification( ctx context.Context, tx libkv.Tx, notification Notification, ) error
type NotificationMapperTx ¶
type NotificationMessage ¶
type NotificationMessage string
func NotificationMessagef ¶
func NotificationMessagef(format string, a ...any) NotificationMessage
func (NotificationMessage) String ¶
func (n NotificationMessage) String() string
type NotificationRemoverTx ¶
type NotificationStoreTx ¶
type NotificationStoreTx interface {
NotificationAdderTx
NotificationRemoverTx
NotificationGetterTx
NotificationStreamerTx
NotificationFinderTx
NotificationMapperTx
}
func NewNotificationStoreTx ¶
func NewNotificationStoreTx() NotificationStoreTx
func NewNotificationStoreWithBucketTx ¶
func NewNotificationStoreWithBucketTx( bucketName libkv.BucketName, ) NotificationStoreTx
type NotificationStreamerTx ¶
type NotificationStreamerTxFunc ¶
type NotificationStreamerTxFunc func(ctx context.Context, tx libkv.Tx, ch chan<- Notification) error
func (NotificationStreamerTxFunc) Stream ¶
func (s NotificationStreamerTxFunc) Stream( ctx context.Context, tx libkv.Tx, ch chan<- Notification, ) error
type NotificationTarget ¶
type NotificationTarget string
func (NotificationTarget) Ptr ¶
func (n NotificationTarget) Ptr() *NotificationTarget
func (NotificationTarget) String ¶
func (n NotificationTarget) String() string
type NotificationTargets ¶
type NotificationTargets []NotificationTarget
func ParseNotificationTargets ¶
func ParseNotificationTargets(ctx context.Context, values any) (NotificationTargets, error)
type NotificationType ¶
type NotificationType string
const ( AccountHitLossLimitNotificationType NotificationType = "account-loss-limit" AccountHitProfitLimitNotificationType NotificationType = "account-profit-limit" AgentEscalationNotificationType NotificationType = "agent-escalation" BacktestCompletedNotificationType NotificationType = "backtest-completed" BacktestFailedNotificationType NotificationType = "backtest-failed" BacktestStartedNotificationType NotificationType = "backtest-started" GchatRelevantNotificationType NotificationType = "gchat-relevant" GoReleaseNotificationType NotificationType = "go-release" MantraNotificationType NotificationType = "mantra" PendingApprovalNotificationType NotificationType = "pending-approval" SignalNotificationType NotificationType = "signal" TestNotificationType NotificationType = "test" )
func (NotificationType) String ¶
func (n NotificationType) String() string
type NotificationTypes ¶
type NotificationTypes []NotificationType
func ParseNotificationTypes ¶
func ParseNotificationTypes(values []string) NotificationTypes
func ParseNotificationTypesFromString ¶
func ParseNotificationTypesFromString(value string) NotificationTypes
func (NotificationTypes) Contains ¶
func (n NotificationTypes) Contains(value NotificationType) bool
func (NotificationTypes) Interfaces ¶
func (n NotificationTypes) Interfaces() []interface{}
func (NotificationTypes) Strings ¶
func (n NotificationTypes) Strings() []string
Source Files
¶
- core_cdb-schema.go
- core_notification-handler-tx.go
- core_notification-message-handler-tx.go
- core_notification-message.go
- core_notification-store-message-handler-tx.go
- core_notification-store-tx.go
- core_notification-target.go
- core_notification-type.go
- core_notification.go
- core_run-notification-store-consumer.go
Click to show internal directories.
Click to hide internal directories.