model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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 Planner

type Planner interface {
	common.Service
	Add(todo *entity.Plan) error
	Cancel(id string) error
	Delete(id string, force bool) error
	GetResult(id string) (any, error)
	Stats(opts entity.PlannerStatsOptions) ([]*entity.PlannerStats, 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
}

Jump to

Keyboard shortcuts

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