schema

package
v0.0.0-...-1f1cd5d Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package schema contains DTOs describing services and

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidType - error casting general service to exact type.
	ErrInvalidType = errors.New("invalid service type")

	// ErrMissingService - provider has no matching service to return.
	ErrMissingService = errors.New("provider missing initialized service")
)

Functions

This section is empty.

Types

type AddHandlersFunc

type AddHandlersFunc func(baseGroup, secGroup *echo.Group) error

AddHandlersFunc - function adding handlers to secure or/and unsecure groups.

type ProvidingServices

type ProvidingServices interface {
	Service(id ServiceID) any
}

ProvidingServices describes provider of the services.

type ServiceDefinition

type ServiceDefinition struct {
	// Unique service ID allowing to build service dependency tree
	ID ServiceID
	// Init is a function used to initialized service instance with given state
	Init ServiceInitFunc
	// DependsOn list IDs of the required services.
	DependsOn []ServiceID
	// InitHandlersFunc is a function for initializing service-related handlers
	// after the service is initialized.
	// Can remain `nil` if service does not provide API endpoints.
	InitHandlersFunc func(state ProvidingServices) AddHandlersFunc
}

ServiceDefinition contains service metadata and initialization.

type ServiceID

type ServiceID string

ServiceID - ID of the service.

type ServiceInitFunc

type ServiceInitFunc func(ctx context.Context, state any) (any, error)

ServiceInitFunc - function returning initialized service instance.

type ServiceMapping

type ServiceMapping map[ServiceID]any

ServiceMapping - ServiceID to Service mapping.

Jump to

Keyboard shortcuts

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