repository

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 52 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	version.Version `json:"-" yaml:"-"`
	contract.Path
	contract.Contract
	content.Content `json:",omitempty" yaml:",inline"`
	Async           *async.Config `json:",omitempty"`
	View            *view.View    `json:",omitempty"`
	NamespacedView  *view.NamespacedView
	Handler         *handler.Handler `json:",omitempty"`

	SourceURL string
	// contains filtered or unexported fields
}

Component represents abstract API view/handler based component

func NewComponent

func NewComponent(path *contract.Path, options ...ComponentOption) (*Component, error)

func (*Component) Doc

func (c *Component) Doc() (docs.Service, bool)

func (*Component) Exclusion

func (c *Component) Exclusion(state *view.State) []*json.FilterEntry

func (*Component) GenerateOutputCode

func (c *Component) GenerateOutputCode(withEmbed bool, withDefineComponent bool, embeds map[string]string, namedResources ...string) string

func (*Component) IOConfig

func (c *Component) IOConfig() *config.IOConfig

func (*Component) Init

func (c *Component) Init(ctx context.Context, resource *view.Resource) (err error)

func (*Component) LocatorOptions

func (c *Component) LocatorOptions(request *http.Request, form *state.Form, unmarshal shared.Unmarshal) []locator.Option

func (*Component) TypeRegistry

func (c *Component) TypeRegistry() *xreflect.Types

func (*Component) UnmarshalFunc

func (c *Component) UnmarshalFunc(request *http.Request) shared.Unmarshal

type ComponentOption

type ComponentOption func(c *Component) error

Component represents abstract API view/handler based component

func WithContract

func WithContract(inputType, outputType reflect.Type, embedFs *embed.FS, viewOptions ...view.Option) ComponentOption

func WithHandler

func WithHandler(aHandler xhandler.Handler) ComponentOption

func WithInput

func WithInput(inputType reflect.Type) ComponentOption

func WithNamedResources

func WithNamedResources(names ...string) ComponentOption

func WithOutputCaseFormat

func WithOutputCaseFormat(format string) ComponentOption

func WithResource

func WithResource(resource *view.Resource) ComponentOption

func WithView

func WithView(aView *view.View) ComponentOption

type Components

type Components struct {
	URL        string `json:",omitempty" yaml:",omitempty"`
	Version    version.Control
	With       []string //list of resource to inherit from  `json:",omitempty"`
	Components []*Component
	Resource   *view.Resource
	// contains filtered or unexported fields
}

func LoadComponents

func LoadComponents(ctx context.Context, URL string, opts ...Option) (*Components, error)

func NewComponents

func NewComponents(ctx context.Context, options ...Option) *Components

NewComponents creates components

func (*Components) Init

func (c *Components) Init(ctx context.Context) error

type Option

type Option func(o *Options)

func WithApiPrefix

func WithApiPrefix(prefix string) Option

func WithCacheConnectorPrefix

func WithCacheConnectorPrefix(prefix string) Option

func WithCodecs

func WithCodecs(codecs *codec.Registry) Option

func WithComponentURL

func WithComponentURL(componentURL string) Option

func WithConstants

func WithConstants(key string, value string) Option

func WithDispatcher

func WithDispatcher(fn func(registry *Registry) contract.Dispatcher) Option

func WithExtensions

func WithExtensions(registry *extension.Registry) Option

WithExtensions returns extension option

func WithIgnorePlugin

func WithIgnorePlugin(flag bool) Option

func WithJWTSigner

func WithJWTSigner(aSigner *signer.Config) Option

func WithJWTVerifier

func WithJWTVerifier(aVerifier *verifier.Config) Option

func WithMetrics

func WithMetrics(metrics *gmetric.Service) Option

func WithNoPlugin

func WithNoPlugin() Option

WithNoPlugin returns with no plugin option

func WithPackageTypes

func WithPackageTypes(types ...*view.PackagedType) Option

func WithPath

func WithPath(aPath *path.Path) Option

func WithPluginURL

func WithPluginURL(URL string) Option

func WithPredicates

func WithPredicates(predicates *extension.PredicateRegistry) Option

func WithRefreshFrequency

func WithRefreshFrequency(refreshFrequency time.Duration) Option

func WithResourceURL

func WithResourceURL(URL string) Option

func WithResources

func WithResources(resources Resources) Option

func WithSubstitutes

func WithSubstitutes(name string, substitutes map[string]string) Option

func WithTypes

func WithTypes(types *xreflect.Types) Option

type Options

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

func NewOptions

func NewOptions(opts []Option) *Options

func (*Options) Apply

func (o *Options) Apply(opts ...Option)

func (*Options) UseColumn

func (o *Options) UseColumn() bool

type Provider

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

func NewProvider

func NewProvider(path contract.Path, control *version.Control, newComponent func(ctx context.Context, opts ...Option) (*Component, error)) *Provider

func (*Provider) Component

func (p *Provider) Component(ctx context.Context, opts ...Option) (*Component, error)

func (*Provider) Namespaces

func (r *Provider) Namespaces() []string

func (*Provider) URI

func (r *Provider) URI() string

type Registry

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

func NewRegistry

func NewRegistry(apiPrefix string, newDispatcher func(registry *Registry) contract.Dispatcher) *Registry

func (*Registry) Dispatcher

func (r *Registry) Dispatcher() contract.Dispatcher

func (*Registry) Lookup

func (r *Registry) Lookup(ctx context.Context, path *contract.Path, opts ...Option) (*Component, error)

func (*Registry) LookupProvider

func (r *Registry) LookupProvider(ctx context.Context, path *contract.Path) (*Provider, error)

func (*Registry) Register

func (r *Registry) Register(components ...*Component)

func (*Registry) SetComponents

func (r *Registry) SetComponents(components []*Component)

func (*Registry) SetProviders

func (r *Registry) SetProviders(providers []*Provider)

type Resources

type Resources interface {
	AddResource(key string, aResource *view.Resource)
	Has(key string) bool
	Lookup(key string) (*version.Resource, error)
	Substitutes() map[string]view.Substitutes
	IsCheckDue(t time.Time) bool
	SyncChanges(ctx context.Context) (bool, error)
}

Resources represents a resource

type Service

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

func New

func New(ctx context.Context, opts ...Option) (*Service, error)

func (*Service) Constants

func (s *Service) Constants() []*state.Parameter

func (*Service) Container

func (s *Service) Container() *path.Container

func (*Service) Extensions

func (s *Service) Extensions() *extension.Registry

func (*Service) JWTSigner

func (s *Service) JWTSigner() *signer.Service

JWTSigner returns jwt signer

func (*Service) JWTVerifier

func (s *Service) JWTVerifier() *verifier.Service

JWTVerifier returns jwt signer

func (*Service) Register

func (s *Service) Register(components ...*Component)

func (*Service) Registry

func (s *Service) Registry() *Registry

func (*Service) Resources

func (s *Service) Resources() Resources

func (*Service) SyncChanges

func (s *Service) SyncChanges(ctx context.Context) (bool, error)

SyncChanges checks if resource, plugin or components have changes if so it would increase individual or all component/paths version number resulting in lazy reload

Jump to

Keyboard shortcuts

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