Documentation
¶
Index ¶
- Constants
- func Run(args ...string) error
- type Application
- type BannerPrinter
- type Context
- func (c *Context) Close(ctx context.Context) error
- func (c *Context) Container() component.Container
- func (c *Context) Deadline() (deadline time.Time, ok bool)
- func (c *Context) Done() <-chan struct{}
- func (c *Context) Environment() runtime.Environment
- func (c *Context) Err() error
- func (c *Context) IsRunning() bool
- func (c *Context) Refresh(ctx context.Context) error
- func (c *Context) ResourceResolver() io.ResourceResolver
- func (c *Context) Start(ctx context.Context) error
- func (c *Context) Stop(ctx context.Context) error
- func (c *Context) Value(key any) any
- type Environment
- func (e *Environment) ActiveProfiles() []string
- func (e *Environment) AddActiveProfiles(profiles ...string) error
- func (e *Environment) DefaultProfiles() []string
- func (e *Environment) IsProfileActive(profile string) bool
- func (e *Environment) PropertyResolver() config.PropertyResolver
- func (e *Environment) PropertySources() *config.PropertySources
- func (e *Environment) SetActiveProfiles(profiles ...string) error
- func (e *Environment) SetDefaultProfiles(profiles ...string) error
Constants ¶
const ( // DefaultProfilesProp is the property key for specifying default profiles. DefaultProfilesProp = "procyon.profiles.default" // ActiveProfilesProp is the property key for specifying active profiles. ActiveProfilesProp = "procyon.profiles.active" // DefaultConfigLocation is the default location for configuration files. DefaultConfigLocation = "resources/" )
const (
Version = "v0.0.1-dev"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application is the main entry point of the Procyon framework. It is responsible for initializing the application context, loading resources, and running the application.
func New ¶
func New() *Application
New creates a new instance of the application with default banner printer and resource resolver.
func (*Application) ResourceResolver ¶
func (a *Application) ResourceResolver() io.ResourceResolver
ResourceResolver returns the resource resolver used by the application to load resources.
func (*Application) Run ¶
func (a *Application) Run(args ...string) (err error)
Run starts the application with the given command-line arguments. It initializes the environment, prepares the application context, and invokes any command-line runners defined in the application context.
func (*Application) SetBannerPrinter ¶
func (a *Application) SetBannerPrinter(printer runtime.BannerPrinter)
SetBannerPrinter sets the banner printer to be used by the application to print the banner at startup.
type BannerPrinter ¶
type BannerPrinter struct {
}
func NewBannerPrinter ¶
func NewBannerPrinter() *BannerPrinter
func (*BannerPrinter) Print ¶
func (b *BannerPrinter) Print(_ runtime.Environment, w io.Writer) error
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context struct represents the application context of Procyon.
func (*Context) Close ¶
Close stops the application context, destroys all singleton components, releases resources, and marks the context as canceled.
func (*Context) Container ¶
Container returns the component container associated with this context. It panics if the context has not been refreshed yet.
func (*Context) Deadline ¶
Deadline method returns the time when work done on behalf of this context should be canceled.
func (*Context) Done ¶
func (c *Context) Done() <-chan struct{}
Done method returns a channel that's closed when work done on behalf of this context should be canceled.
func (*Context) Environment ¶
func (c *Context) Environment() runtime.Environment
Environment returns the runtime environment associated with this context.
func (*Context) Err ¶
Err returns the error that caused the context to terminate. It returns nil if the context is still active.
func (*Context) IsRunning ¶
IsRunning returns true if the application context is currently running, false otherwise.
func (*Context) Refresh ¶
Refresh initializes the application context by preparing the container, loading component definitions, initializing singleton components, and starting lifecycle management.
func (*Context) ResourceResolver ¶
func (c *Context) ResourceResolver() io.ResourceResolver
ResourceResolver returns the resource resolver used by the application to load resources.
func (*Context) Start ¶
Start starts the application context. It loads component definitions, registers the context itself as a singleton, and initializes singleton components. After this method is called, the context is considered running.
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment represents the default implementation of the Environment interface.
func (*Environment) ActiveProfiles ¶
func (e *Environment) ActiveProfiles() []string
ActiveProfiles returns the active profiles.
func (*Environment) AddActiveProfiles ¶
func (e *Environment) AddActiveProfiles(profiles ...string) error
AddActiveProfiles adds active profiles.
func (*Environment) DefaultProfiles ¶
func (e *Environment) DefaultProfiles() []string
DefaultProfiles returns the default profiles.
func (*Environment) IsProfileActive ¶
func (e *Environment) IsProfileActive(profile string) bool
IsProfileActive checks if a profile is active.
func (*Environment) PropertyResolver ¶
func (e *Environment) PropertyResolver() config.PropertyResolver
PropertyResolver returns the property resolver.
func (*Environment) PropertySources ¶
func (e *Environment) PropertySources() *config.PropertySources
PropertySources returns the property sources.
func (*Environment) SetActiveProfiles ¶
func (e *Environment) SetActiveProfiles(profiles ...string) error
SetActiveProfiles sets the active profiles.
func (*Environment) SetDefaultProfiles ¶
func (e *Environment) SetDefaultProfiles(profiles ...string) error
SetDefaultProfiles sets the default profiles.