micro

package
v0.0.42 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDecodingError = errors.New("decoding error")
)

Functions

func AddEndpoint added in v0.0.12

func AddEndpoint(subject string, group micro.Group, fn Handler, opts ...EndpointOption) error

func MicroOptions added in v0.0.35

func MicroOptions(cfg micro.Config) *microOpts

func UUIDMapper

func UUIDMapper(t reflect.Type) []reflect.StructField

Types

type AttacherFunc added in v0.0.35

type AttacherFunc func(ctx context.Context, mcfg MicroEndpointConfig, group micro.Group) error

type AttacherListFunc added in v0.0.35

type AttacherListFunc func() []AttacherFunc

type ContextFunc added in v0.0.12

type ContextFunc func(context.Context, string, micro.Headers) context.Context

type DecoderFunc added in v0.0.12

type DecoderFunc func(b []byte) (any, error)

type EncoderFunc added in v0.0.12

type EncoderFunc func(v any) ([]byte, error)

type EndpointAttacher

type EndpointAttacher AttacherListFunc

type EndpointOption added in v0.0.12

type EndpointOption func(*endpointOpts) error

func WithContext

func WithContext(ctx context.Context) EndpointOption

func WithContextFn added in v0.0.12

func WithContextFn(fn ContextFunc) EndpointOption

func WithDecoderFn added in v0.0.12

func WithDecoderFn(fn DecoderFunc) EndpointOption

func WithEncoderFn added in v0.0.12

func WithEncoderFn(fn EncoderFunc) EndpointOption

func WithErrFn added in v0.0.12

func WithErrFn(fn ErrorFunc) EndpointOption

func WithJsonSchema added in v0.0.12

func WithJsonSchema(reflector jsonschema.Reflector, req interface{}, res interface{}) EndpointOption

func WithLogger added in v0.0.34

func WithLogger(logger *zap.SugaredLogger, args ...interface{}) EndpointOption

func WithLoggerRequestFields added in v0.0.34

func WithLoggerRequestFields(args ...interface{}) EndpointOption

func WithMiddlewares added in v0.0.12

func WithMiddlewares(mws ...Middleware) EndpointOption

func WithTimeout added in v0.0.12

func WithTimeout(t time.Duration) EndpointOption

func WrapEndpointOptions added in v0.0.35

func WrapEndpointOptions(mo MicroEndpointConfig, subject string, baseOptions []EndpointOption) []EndpointOption

type ErrorFunc added in v0.0.12

type ErrorFunc func(err error) (string, string, []byte, micro.Headers)

type Handler added in v0.0.12

type Handler func(ctx context.Context, req any) (any, error)

func WrapTypedEndpoint added in v0.0.35

func WrapTypedEndpoint[R any, T any](fn HandlerTyped[R, T]) Handler

type HandlerTyped added in v0.0.35

type HandlerTyped[R any, T any] func(ctx context.Context, req R) (T, error)

type MicroEndpointConfig added in v0.0.35

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

type MicroOption added in v0.0.34

type MicroOption func(*microOpts) error

func WithErrorFunc added in v0.0.34

func WithErrorFunc(fn ErrorFunc) MicroOption

func WithMicroLogger added in v0.0.34

func WithMicroLogger(logger *zap.SugaredLogger) MicroOption

func WithMicroMiddlewares added in v0.0.42

func WithMicroMiddlewares(mws ...Middleware) MicroOption

type Middleware added in v0.0.12

type Middleware func(Handler) Handler

type Schema added in v0.0.12

type Schema struct {
	Request  string `json:"request"`
	Response string `json:"response"`
}

func GenerateJsonSchema added in v0.0.12

func GenerateJsonSchema(reflector jsonschema.Reflector, req interface{}, res interface{}) (*Schema, error)

type ServiceError added in v0.0.40

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

func NewError added in v0.0.40

func NewError(err error, code string, body []byte, headers map[string][]string) *ServiceError

func (*ServiceError) Error added in v0.0.40

func (e *ServiceError) Error() string

func (*ServiceError) ErrorParts added in v0.0.40

func (e *ServiceError) ErrorParts() (string, string, []byte, micro.Headers)

Jump to

Keyboard shortcuts

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