Procyon

Procyon

  • Documentation
  • Modules
  • Help
  • Blog

›Modules

Modules

  • Introduction
  • Procyon
  • Procyon Core
  • Procyon Context
  • Procyon Web
  • Procyon Peas

Procyon Core

This part gives you a basic understanding of Procyon Core Module.

Components

All instances managed by the framework such as Controller, Initializers and Processors are considered as a component.

Register Component

It's used to register the components. However, you can pass only a construction-function into it. Construction function means a function returning only one type but it can have multiple parameters.

func Register(components ...Component)

The example is given below.

type MyComponent struct {

}

func NewMyComponent() MyComponent {
    return MyComponent{}
}

func init() {
    core.Register(NewMyComponent) 
}

Component Processor

This allows you to process the components registered before application starts.

type ComponentProcessor interface {
    SupportsComponent(typ goo.Type) bool
    ProcessComponent(typ goo.Type) error
}
  • SupportsComponent if it returns true, it means that the component will be processed by this component processor.
  • ProcessComponent If the method SupportComponent returns true, it will be invoked.

The example of a custom component processor is given below.

type CustomComponentProcessor struct {
}

func NewCustomComponentProcessor() CustomComponentProcessor {
    return CustomComponentProcessor{}
}

func (processor CustomComponentProcessor) SupportsComponent(typ goo.Type) bool {
    // do whatever you want
    return false
}

func (processor CustomComponentProcessor) ProcessComponent(typ goo.Type) error {
    // do whatever you want
    return nil
}

Note that you need to register pea processors and initializers by using the function core.Register.

← ProcyonProcyon Context →
  • Components
    • Register Component
    • Component Processor
Procyon
Modules
ProcyonProcyon CoreProcyon ContextProcyon WebProcyon Peas
Community
Discord
More
BlogGitHubStar
Copyright © 2020 Procyon