core

package module
v0.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: BSD-2-Clause Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

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

func RunNotificationStoreConsumer

func RunNotificationStoreConsumer(
	saramaClient libkafka.SaramaClient,
	db libkv.DB,
	branch base.Branch,
	batchSize libkafka.BatchSize,
	trigger run.Fire,
) run.Func

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"`
}

func (Notification) Validate

func (n Notification) Validate(ctx context.Context) error

type NotificationAdderTx

type NotificationAdderTx interface {

	// Add notification to store
	Add(ctx context.Context, tx libkv.Tx, notification Notification) error
}

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 NotificationMapperTx interface {
	Map(
		ctx context.Context,
		tx libkv.Tx,
		fn func(ctx context.Context, notification Notification) error,
	) error
}

type NotificationMessage

type NotificationMessage string

func NotificationMessagef

func NotificationMessagef(format string, a ...any) NotificationMessage

func (NotificationMessage) String

func (n NotificationMessage) String() string

func (NotificationMessage) Validate

func (n NotificationMessage) Validate(ctx context.Context) error

type NotificationRemoverTx

type NotificationRemoverTx interface {

	// Remove notification to store
	Remove(ctx context.Context, tx libkv.Tx, identifier base.Identifier) error
}

type NotificationStreamerTx

type NotificationStreamerTx interface {

	// Stream all notifications from store
	Stream(ctx context.Context, tx libkv.Tx, ch chan<- Notification) error
}

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 (NotificationTarget) String

func (n NotificationTarget) String() string

func (NotificationTarget) Validate

func (n NotificationTarget) Validate(ctx context.Context) error

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

func (NotificationType) Validate

func (n NotificationType) Validate(ctx context.Context) error

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

Directories

Path Synopsis
command
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL