rest

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrvalueNotStructOrPointer value is not struct or pointer / value 不是结构体或指针
	ErrValueNotStructOrPointer = errors.New("value is not struct or pointer")
	ErrInvalidType             = errors.New("invalid type")
)

Functions

func Test

func Test(v any)

Types

type Groupor

type Groupor interface {
	// contains filtered or unexported methods
}

type Groupot

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

群组元数据

func Group

func Group(prefix string, structs ...any) *Groupot

func (*Groupot) Tags

func (g *Groupot) Tags(ss ...string) *Groupot

type HackType

type HackType int8
const (
	RequestHack HackType = iota << 1
	ResponseHack
)

type Hackor

type Hackor interface {
	Name() string
	Invoke(ctx context.Context)
	// contains filtered or unexported methods
}

type Hackot

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

群组元数据

func Hack

func Hack(htp HackType, handler func(ctx context.Context)) *Hackot

func (*Hackot) Invoke

func (m *Hackot) Invoke(ctx context.Context)

func (*Hackot) Name

func (m *Hackot) Name() string

type Methodor

type Methodor interface {
	Invoke(ctx context.Context, input interface{}) (interface{}, error)
	// contains filtered or unexported methods
}

端点接口

type Methodot

type Methodot[i, o any] struct {
	// contains filtered or unexported fields
}

端点结构

func Method

func Method[req, res any](handler func(ctx context.Context, input *req) (res, error)) *Methodot[req, res]

新建端点

func (*Methodot[i, o]) Description

func (m *Methodot[i, o]) Description(desc string) *Methodot[i, o]

func (*Methodot[i, o]) Handler

func (m *Methodot[i, o]) Handler(handler func(ctx context.Context, input *i) (o, error)) *Methodot[i, o]

func (*Methodot[req, res]) Invoke

func (m *Methodot[req, res]) Invoke(ctx context.Context, input interface{}) (interface{}, error)

func (*Methodot[i, o]) Summary

func (m *Methodot[i, o]) Summary(summary string) *Methodot[i, o]

func (*Methodot[i, o]) Tags

func (m *Methodot[i, o]) Tags(ss ...string) *Methodot[i, o]

type Middlewareor

type Middlewareor interface {
	Name() string
	Invoke(ctx context.Context)
	// contains filtered or unexported methods
}

type Middlewareot

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

群组元数据

func Middleware

func Middleware(handler func(ctx context.Context)) *Middlewareot

func (*Middlewareot) Invoke

func (m *Middlewareot) Invoke(ctx context.Context)

func (*Middlewareot) Name

func (m *Middlewareot) Name() string

Jump to

Keyboard shortcuts

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