Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶ added in v0.4.0
type Database interface {
common.Service
ORM() *gorm.DB
DB() *sql.DB
FromContext(ctx context.Context) *gorm.DB
FromContextTimeout(ctx context.Context, timeout time.Duration) (*gorm.DB, context.CancelFunc)
Cleanup(schema bool) error
Reload() error
// Transaction executes fn within a database transaction.
Transaction(ctx context.Context, fn func(tctx context.Context) error, opts ...*sql.TxOptions) error
}
type Pubsub ¶
type Pubsub interface {
common.Service
common.MessageSender
common.RawMessageSender
// Publish sends a message to all subscribers of the given topic.
// The publisher (from) will NOT receive its own message.
// If payload implements common.Message, MessageHandler subscribers are notified.
// RawMessageHandler subscribers are always notified.
Publish(from common.Named, topic string, kind string, payload any)
// Subscribe registers a service to receive events on the given topic.
// Topics are hierarchical: subscribing to "app" receives events from
// "app", "app/module", "app/module/component", etc.
Subscribe(svc common.Named, topic string)
// Unsubscribe removes a service's subscription from the given topic.
Unsubscribe(svc common.Named, topic string)
}
type Supervisor ¶ added in v0.4.0
type Supervisor interface {
common.Service
Register(services ...common.Service)
TopoSort() error
Services() []common.Service
Stats() ([]*entity.SupervisorStats, error)
// Migrate() error
InitService(ctx context.Context, name string) error
StartService(name string) error
StopService(name string, wait bool) error
RestartService(ctx context.Context, name string) error
Restart(ctx context.Context) error
}
Click to show internal directories.
Click to hide internal directories.