runkit

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 26 Imported by: 0

README

Dogma Engine Reference Implementation

This is a reference implementation of a Dogma engine.

Documentation Latest Version Build Status Code Coverage

Documentation

Index

Constants

View Source
const (
	// DefaultProjectionCompactInterval is the default minimum time between
	// projection compaction attempts.
	DefaultProjectionCompactInterval = 6 * time.Hour
)

Variables

This section is empty.

Functions

func CreateSchema added in v0.1.2

func CreateSchema(ctx context.Context, db *sql.DB) error

CreateSchema creates the database schema used by the engine.

func DropSchema added in v0.1.2

func DropSchema(ctx context.Context, db *sql.DB) error

DropSchema drops the database schema used by the engine.

Types

type Engine

type Engine struct {
	// DB is the database connection to use.
	DB *sql.DB

	// App is the Dogma application to run.
	App dogma.Application

	// Logger is the structured logger used by the engine.
	//
	// If it is nil, [slog.Default] is used.
	Logger *slog.Logger

	// ProjectionCompactInterval is the minimum time between projection
	// compaction attempts. If non-positive [DefaultProjectionCompactInterval]
	// is used.
	ProjectionCompactInterval time.Duration
	// contains filtered or unexported fields
}

Engine is a Dogma engine backed by a single PostgreSQL database.

It implements dogma.CommandExecutor.

func (*Engine) ExecuteCommand

func (e *Engine) ExecuteCommand(
	ctx context.Context,
	command dogma.Command,
	options ...dogma.ExecuteCommandOption,
) error

ExecuteCommand submits a [Command] for execution.

It returns once the engine has taken ownership of the command. By default, it doesn't wait for handling to finish.

See dogma.CommandExecutor for more details.

func (*Engine) Ready

func (e *Engine) Ready() <-chan struct{}

Ready returns a channel that is closed when the engine is ready to accept commands for execution.

It is exposed as an operational signal. For example, to signal readiness to a load balancer. It is not an error to attempt command execution before the engine is ready.

func (*Engine) Run

func (e *Engine) Run(ctx context.Context) error

Run starts the engine and blocks until ctx is canceled.

Directories

Path Synopsis
internal
aggregate
Package aggregate provides engine components that orchestrate the execution of aggregate message handlers.
Package aggregate provides engine components that orchestrate the execution of aggregate message handlers.
concurrency
Package concurrency provides utilities for enforcing a handler's concurrency preference.
Package concurrency provides utilities for enforcing a handler's concurrency preference.
contexthook
Package contexthook provides utilities for adding request-scoped testing hooks to contexts.
Package contexthook provides utilities for adding request-scoped testing hooks to contexts.
integration
Package integration provides engine components that orchestrate the execution of integration message handlers.
Package integration provides engine components that orchestrate the execution of integration message handlers.
messagepump
Package messagepump generalizes a message pump that acquires messages for processing and dispatches them to a worker pool.
Package messagepump generalizes a message pump that acquires messages for processing and dispatches them to a worker pool.
process
Package process provides engine components that orchestrate the execution of process message handlers.
Package process provides engine components that orchestrate the execution of process message handlers.
projection
Package projection provides engine components that orchestrate the execution of projection message handlers.
Package projection provides engine components that orchestrate the execution of projection message handlers.
schema
Package schema defines the PostgreSQL schema used by the engine.
Package schema defines the PostgreSQL schema used by the engine.
x/xerrors
Package xerrors provides utilities for error handling.
Package xerrors provides utilities for error handling.
x/xsql
Package xsql provides utilities for working with SQL databases.
Package xsql provides utilities for working with SQL databases.
x/xtesting
Package xtesting provides utilities for testing.
Package xtesting provides utilities for testing.

Jump to

Keyboard shortcuts

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