operator

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func TypeOfOperator

func TypeOfOperator(t reflect.Type) reflect.Type

Types

type BasePathDescriber

type BasePathDescriber interface {
	BasePath() string
}

type DefaultSetter

type DefaultSetter interface {
	SetDefault()
}

type EmptyOperator

type EmptyOperator struct{}

func (EmptyOperator) NoOutput

func (EmptyOperator) NoOutput()

func (EmptyOperator) Output

func (EmptyOperator) Output(context.Context) (any, error)

type Factory

type Factory struct {
	Type       reflect.Type
	ContextKey any
	NoOutput   bool
	Params     url.Values
	IsLast     bool
	Operator   Operator
}

func NewFactory

func NewFactory(op Operator, last bool) *Factory

func (*Factory) New

func (f *Factory) New() (op Operator)

func (*Factory) String

func (f *Factory) String() string

type HasContextKey

type HasContextKey interface {
	Operator
	ContextKey() any
}

type HasMiddlewares

type HasMiddlewares interface {
	Middlewares() []Operator
}

type HasParameters

type HasParameters interface {
	OperatorParameters() map[string][]string
}

type Initializer

type Initializer interface {
	Init(context.Context) error
}

type InitializerFrom

type InitializerFrom interface {
	Operator
	InitFromOperator(Operator)
}

type MetaOperator

type MetaOperator struct {
	EmptyOperator
	// contains filtered or unexported fields
}
Example
op := BasePathOperator("/base")
fmt.Println(op.(BasePathDescriber).BasePath())
fmt.Println(op)

op = GroupOperator("/base/group")
fmt.Println(op.(PathDescriber).Path())
fmt.Println(op)
Output:
/base
base(/base)
/base/group
group(/base/group)

func (*MetaOperator) BasePath

func (g *MetaOperator) BasePath() string

func (*MetaOperator) Path

func (g *MetaOperator) Path() string

func (*MetaOperator) String

func (g *MetaOperator) String() string

type Newer

type Newer interface {
	Operator
	New() Operator
}

type NoOutput

type NoOutput interface {
	Operator
	NoOutput()
}

type Operator

type Operator interface {
	Output(context.Context) (any, error)
}

func BasePathOperator

func BasePathOperator(base string) Operator

func GroupOperator

func GroupOperator(group string) Operator

type PathDescriber

type PathDescriber interface {
	Path() string
}

Jump to

Keyboard shortcuts

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