shared

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetaKeyResource       = "__resource"
	MetaKeyRESTHttpMethod = "__http_method"
	MetaKeyRESTHttpPath   = "__http_path"
)
View Source
const (
	AuthOptionPermToken = "__perm_token"
)

Variables

View Source
var (
	ErrResourceNil              = errors.New("resource cannot be nil")
	ErrResourceNameEmpty        = errors.New("resource name cannot be empty")
	ErrOperationNotFound        = errors.New("operation not found")
	ErrOperationActionEmpty     = errors.New("operation action cannot be empty")
	ErrNoRouterForKind          = errors.New("no router can handle operation type")
	ErrNoRouterFound            = errors.New("no router found")
	ErrNoHandlerResolverFound   = errors.New("no handler resolver found")
	ErrHandlerRequired          = errors.New("handler is required for REST operations")
	ErrMethodNotFound           = errors.New("api action method not found")
	ErrMethodAmbiguous          = errors.New("api action method matches multiple methods")
	ErrHandlerInvalidReturnType = errors.New("handler method has invalid return type, must be 'error'")
	ErrHandlerTooManyReturns    = errors.New("handler method has too many return values")
	ErrHandlerMustBeFunc        = errors.New("provided handler must be a function")
	ErrHandlerNil               = errors.New("provided handler function cannot be nil")
)

Sentinel errors for API engine operations.

Functions

func Operation

func Operation(ctx fiber.Ctx) *api.Operation

func Request

func Request(ctx fiber.Ctx) *api.Request

func SetOperation

func SetOperation(ctx fiber.Ctx, op *api.Operation)

func SetRequest

func SetRequest(ctx fiber.Ctx, req *api.Request)

Types

type BaseError

type BaseError struct {
	Identifier *api.Identifier
	Err        error
}

func (*BaseError) Error

func (e *BaseError) Error() string

func (*BaseError) Unwrap

func (e *BaseError) Unwrap() error

Unwrap returns the underlying error, allowing errors.As and errors.Is to work correctly.

type DuplicateError

type DuplicateError struct {
	BaseError

	Existing *api.Operation
}

func (*DuplicateError) Error

func (e *DuplicateError) Error() string

type NotFoundError

type NotFoundError struct {
	BaseError

	Suggestion *api.Identifier
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Jump to

Keyboard shortcuts

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