Version: v0.3.1 Latest Latest

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 11 Imported by: 0




This section is empty.


View Source
var (
	// DefinitionNoMethod represents no http method error.
	DefinitionNoMethod = errors.InternalServerError.Build("Nirvana:Service:DefinitionNoMethod", "no http method in [${method}]${path}")
	// DefinitionNoConsumes represents no content type to consume.
	DefinitionNoConsumes = errors.InternalServerError.Build("Nirvana:Service:DefinitionNoConsumes", "no content type to consume in [${method}]${path}")
	// DefinitionNoProduces represents no content type to produce.
	DefinitionNoProduces = errors.InternalServerError.Build("Nirvana:Service:DefinitionNoProduces", "no content type to produce in [${method}]${path}")
	// DefinitionNoErrorProduces represents no content type to produce error.
	DefinitionNoErrorProduces = errors.InternalServerError.Build("Nirvana:Service:DefinitionNoErrorProduces", "no content type to produce error in [${method}]${path}")
	// DefinitionNoFunction represents no function error.
	DefinitionNoFunction = errors.InternalServerError.Build("Nirvana:Service:DefinitionNoFunction", "no function in [${method}]${path}")
	// DefinitionInvalidFunctionType represents invalid function type.
	DefinitionInvalidFunctionType = errors.InternalServerError.Build("Nirvana:Service:DefinitionInvalidFunctionType", "${type} is not function in [${method}]${path}")
	// DefinitionNoConsumer represents no consumer error.
	DefinitionNoConsumer = errors.InternalServerError.Build("Nirvana:Service:DefinitionNoConsumer", "no consumer for content type ${type} in [${method}]${path}")
	// DefinitionNoProducer represents no producer error.
	DefinitionNoProducer = errors.InternalServerError.Build("Nirvana:Service:DefinitionNoProducer", "no producer for content type ${type} in [${method}]${path}")
	// DefinitionConflict represents conflict error.
	DefinitionConflict = errors.InternalServerError.Build("Nirvana:Service:DefinitionConflict", "consumer-producer pair ${key}:${value} conflicts in [http.${method}]${path}")
	// DefinitionUnmatchedParameters represents parameters unmatch.
	DefinitionUnmatchedParameters = errors.InternalServerError.Build(
		"function ${function} has ${count} parameters but want ${desired} in ${path}, you can define it with descriptor->definition[]->parameters[]",
	// DefinitionUnmatchedResults represents results unmatch.
	DefinitionUnmatchedResults = errors.InternalServerError.Build(
		"function ${function} has ${count} results but want ${desired} in ${path}, you can define it with descriptor->definition[]->results[]",
	// NoDestinationHandler represents no DestinationHandler error.
	NoDestinationHandler = errors.InternalServerError.Build(
		"no destination handler for destination ${destination}, you can define it with descriptor->definition[]->results[]->destination",
	// InvalidParameter represents invalid parameter error.
	InvalidParameter = errors.InternalServerError.Build("Nirvana:Service:InvalidParameter", "can't validate ${order} parameter of function ${name}: ${err}")
	// InvalidResult represents invalid parameter error.
	InvalidResult = errors.InternalServerError.Build("Nirvana:Service:InvalidResult", "can't validate ${order} result of function ${name}: ${err}")
	// InvalidOperatorsForParameter represents invalid operators error.
	InvalidOperatorsForParameter = errors.InternalServerError.Build("Nirvana:Service:InvalidOperatorsForParameter", "can't validate operators for ${order} parameter of function ${name}: ${err}")
	// InvalidOperatorsForResult represents invalid operators error.
	InvalidOperatorsForResult = errors.InternalServerError.Build("Nirvana:Service:InvalidOperatorsForResult", "can't validate operators for ${order} result of function ${name}: ${err}")


This section is empty.


type Executor

type Executor interface {

	ContentTypeMap() map[string][]string
	Acceptable(string) bool
	Producible([]string) bool

Executor executes with a context.

func DefinitionToExecutor

func DefinitionToExecutor(urlPath string, d definition.Definition, customCode int) (Executor, error)

DefinitionToExecutor generates a Executor for the Definition.

type MiddlewareExecutor

type MiddlewareExecutor interface {
	// Execute executes with context.
	Execute(context.Context) error

MiddlewareExecutor executes with a context.

func NewMiddlewareExecutor

func NewMiddlewareExecutor(ms []definition.Middleware, e MiddlewareExecutor) MiddlewareExecutor

NewMiddlewareExecutor creates a new executor with middlewares.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL