runtime

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultContext

func DefaultContext() context.Context

DefaultContext returns Runa's fallback root context.

func DefaultInjector

func DefaultInjector() do.Injector

DefaultInjector returns the default application DI container.

func Invoke

func Invoke[T any](app *App) (T, error)

Invoke returns a dependency from the application container.

func InvokeDefault

func InvokeDefault[T any]() (T, error)

InvokeDefault returns a dependency from the default container.

func MustInvoke

func MustInvoke[T any](app *App) T

MustInvoke returns a dependency or panics.

func MustInvokeDefault

func MustInvokeDefault[T any]() T

MustInvokeDefault returns a dependency from the default container or panics.

func Provide

func Provide[T any](app *App, constructor func(*App) (T, error))

Provide registers a lazy dependency constructor.

func ProvideDefault

func ProvideDefault[T any](constructor func(*App) (T, error))

ProvideDefault registers a lazy dependency constructor on the default container.

func ProvideDefaultValue

func ProvideDefaultValue[T any](value T)

ProvideDefaultValue registers an eager dependency value on the default container.

func ProvideValue

func ProvideValue[T any](app *App, value T)

ProvideValue registers an eager dependency value.

func Run

func Run(ctx context.Context) error

Run executes the default application.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the Runa application runtime facade.

func Default

func Default() *App

Default returns the process-wide default application.

func New

func New(options ...Option) *App

New creates a Runa application.

func SetDefault

func SetDefault(app *App) *App

SetDefault sets the process-wide default application.

func (*App) App

func (app *App) App() any

App exposes the concrete application object to provider.Context users.

func (*App) AppPath

func (app *App) AppPath(paths ...string) string

AppPath returns the application app path joined with optional segments.

func (*App) BasePath

func (app *App) BasePath(paths ...string) string

BasePath returns the application base path joined with optional segments.

func (*App) Command

func (app *App) Command(commands ...runacommand.Command) *App

Command registers application commands.

func (*App) ConfigPath

func (app *App) ConfigPath(paths ...string) string

ConfigPath returns the application config path joined with optional segments.

func (*App) Context

func (app *App) Context() context.Context

Context returns the application runtime context.

func (*App) DataPath

func (app *App) DataPath(paths ...string) string

DataPath returns the application data path joined with optional segments.

func (*App) Env

func (app *App) Env() string

Env returns the application environment.

func (*App) Execute

func (app *App) Execute(ctx context.Context, args []string) error

Execute runs an application command. Empty args default to serve.

func (*App) Freeze

func (app *App) Freeze(ctx context.Context) error

Freeze compiles registrations and boots the app once.

func (*App) Host

func (app *App) Host(units ...host.Unit) *App

Host registers application host units.

func (*App) HostInfo

func (app *App) HostInfo() []host.Info

Hosts returns application host snapshots.

func (*App) HostStatus

func (app *App) HostStatus(name string) host.Status

HostStatus returns a host unit status by name.

func (*App) Injector

func (app *App) Injector() do.Injector

Injector exposes the application DI container to providers.

func (*App) Inspect

func (app *App) Inspect() InspectInfo

func (*App) Install

func (app *App) Install(providers ...runaprovider.Provider) *App

Install installs providers.

func (*App) Module

func (app *App) Module(modules ...Module) *App

Module registers modules.

func (*App) ModuleInfo

func (app *App) ModuleInfo() []ModuleInfo

ModuleInfo returns module registration information.

func (*App) PublicPath

func (app *App) PublicPath(paths ...string) string

PublicPath returns the application public path joined with optional segments.

func (*App) RegisterCommand

func (app *App) RegisterCommand(commands ...runacommand.Command) error

RegisterCommand registers commands from provider implementations.

func (*App) RegisterHost

func (app *App) RegisterHost(units ...host.Unit) error

RegisterHost registers host units from provider implementations.

func (*App) RegisterModule

func (app *App) RegisterModule(modules ...any) error

RegisterModule registers modules from provider implementations.

func (*App) RegisterRouteService

func (app *App) RegisterRouteService(services ...any) error

RegisterRouteService broadcasts app-scoped services to transport providers that opt into route-style service binding.

func (*App) RegisterService

func (app *App) RegisterService(services ...any) error

RegisterService registers services from provider implementations.

func (*App) Run

func (app *App) Run(ctx context.Context) error

Run executes the CLI-first application entry.

func (*App) Service

func (app *App) Service(services ...Service) *App

Service registers services.

func (*App) SetContext

func (app *App) SetContext(ctx context.Context) *App

SetContext sets the application runtime context.

func (*App) Shutdown

func (app *App) Shutdown(ctx context.Context) error

Shutdown stops modules, services, and DI-managed resources.

func (*App) Timezone

func (app *App) Timezone() string

Timezone returns the configured application timezone name.

type InspectInfo

type InspectInfo struct {
	Env      string       `json:"env"`
	BasePath string       `json:"base_path"`
	Modules  []ModuleInfo `json:"modules"`
	Hosts    []host.Info  `json:"hosts"`
	Commands []string     `json:"commands"`
	Services []string     `json:"services"`
}

type Module

type Module = runaprovider.Module

Module is a business module entry.

type ModuleBase

type ModuleBase = runaprovider.ModuleBase

ModuleBase provides no-op lifecycle methods for modules.

type ModuleDepends

type ModuleDepends = runaprovider.ModuleDepends

ModuleDepends lets a module declare hard dependencies by module name.

type ModuleInfo

type ModuleInfo struct {
	Name    string
	Depends []string
	Status  string
}

ModuleInfo stores module registration status.

type Option

type Option func(*App)

Option configures an App during creation.

func AppPath

func AppPath(path string) Option

AppPath sets the application app path.

func BasePath

func BasePath(path string) Option

BasePath sets the application base path.

func ConfigPath

func ConfigPath(path string) Option

ConfigPath sets the application config path.

func DataPath

func DataPath(path string) Option

DataPath sets the application data path.

func Env

func Env(name string) Option

Env sets the application environment name.

func PublicPath

func PublicPath(path string) Option

PublicPath sets the application public path.

func Timezone

func Timezone(name string) Option

Timezone sets the application timezone.

func Writer

func Writer(out io.Writer, errOut ...io.Writer) Option

Writer sets command output writers.

type Service

type Service = runaprovider.Service

Service is a framework or infrastructure capability with lifecycle hooks.

type ServiceBase

type ServiceBase = runaprovider.ServiceBase

ServiceBase provides no-op lifecycle methods for services.

Jump to

Keyboard shortcuts

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