pick

package
v0.0.0-...-f5948c0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT, BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const Template = `` /* 353-byte string literal not displayed */

Variables

View Source
var (
	Svcs = make([]Service, 0)

	ClaimsType  = reflect.TypeOf((*Context)(nil)).Elem()
	ContextType = reflect.TypeOf((*context.Context)(nil)).Elem()
	ErrorType   = reflect.TypeOf((*error)(nil)).Elem()
)
View Source
var GroupApiInfos []*GroupApiInfo

Functions

func Api

func Api(f func())

func Api2

func Api2(f func() any)

兼容有返回值和无返回值的写法

func Connect

func Connect(p string) *apiInfo

func DefinitionsApi

func DefinitionsApi(definitions map[string]spec.Schema, v interface{}, exclude []string)

func Delete

func Delete(p string) *apiInfo

func GenApiDoc

func GenApiDoc(modName string)

func Get

func Get(p string) *apiInfo

func GetMethodInfo

func GetMethodInfo(method *reflect.Method, preUrl string, claimsTyp reflect.Type) (info *apiInfo)

recover捕捉panic info

func Head(p string) *apiInfo

func Log

func Log(method, path, title string)

func Markdown

func Markdown(filePath, modName string)

有swagger,有没有必要做

func Options

func Options(p string) *apiInfo

func ParseMethodName

func ParseMethodName(originName string, methods []string) (method, name string, version int)

从方法名称分析出接口名和版本号

func Patch

func Patch(p string) *apiInfo

func Post

func Post(p string) *apiInfo

func Put

func Put(p string) *apiInfo

func RegisterService

func RegisterService(svc ...Service)

func Registered

func Registered()

func ResHandler

func ResHandler(c *http_context.Context, w http.ResponseWriter, result []reflect.Value)

func Swagger

func Swagger(filePath, modName string)

func Trace

func Trace(p string) *apiInfo

Types

type ApiDocInfo

type ApiDocInfo struct {
	ApiInfo *apiInfo
	Method  reflect.Type
}

type ApiInfo

type ApiInfo struct {
	Path, Method, Title string
	Version             int
	Changelog           []changelog
	Createlog           changelog
	Deprecated          *changelog
	Middleware          []http.HandlerFunc
}

func (*ApiInfo) GetApiInfo

func (api *ApiInfo) GetApiInfo() *apiInfo

type Context

type Context interface {
	context.Context
	jwt.Claims
	grpc.ServerTransportStream
}

type GroupApiInfo

type GroupApiInfo struct {
	Describe string
	Infos    []*ApiDocInfo
}

type PMApi

type PMApi struct {
	Name                    string                    `json:"name"`
	ProtocolProfileBehavior PMProtocolProfileBehavior `json:"protocolProfileBehavior"`
	Request                 PMRequest                 `json:"request"`
	Response                []interface{}             `json:"response"`
}

type PMBody

type PMBody struct {
	Mode string `json:"mode"`
	Raw  string `json:"raw"`
}

type PMCategory

type PMCategory struct {
	Name                    string                    `json:"name"`
	ProtocolProfileBehavior PMProtocolProfileBehavior `json:"protocolProfileBehavior"`
	Items                   []PMApi                   `json:"item"`
}

type PMFile

type PMFile struct {
	Info  PMInfo       `json:"info"`
	Items []PMCategory `json:"item"`
}

type PMHeader

type PMHeader struct {
	Key     string `json:"key"`
	Value   string `json:"value"`
	Type    string `json:"type"`
	Disable bool   `json:"disable"`
}

TODO

type PMInfo

type PMInfo struct {
	PostManId string `json:"_postman_id"`
	Name      string `json:"name"`
	Schema    string `json:"schema"`
}

type PMProtocolProfileBehavior

type PMProtocolProfileBehavior struct {
	DisableBodyPruning bool `json:"disableBodyPruning"`
}

type PMQuery

type PMQuery struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type PMRequest

type PMRequest struct {
	Method      string     `json:"method"`
	Header      []PMHeader `json:"header"`
	Body        PMBody     `json:"body"`
	Description string     `json:"description"`
	URL         PMUrl      `json:"url"`
}

type PMUrl

type PMUrl struct {
	Raw      string    `json:"raw"`
	Protocol string    `json:"protocol"`
	Host     []string  `json:"host"`
	Path     []string  `json:"path"`
	Query    []PMQuery `json:"query"`
}

type ParamTable

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

type ParseFromHttpRequest

type ParseFromHttpRequest interface {
	Parse(req *http.Request) error
}

type ParseToHttpResponse

type ParseToHttpResponse interface {
	Parse() ([]byte, error)
}

type Service

type Service interface {
	//返回描述,url的前缀,中间件
	Service() (describe, prefix string, middleware []http.HandlerFunc)
}

Directories

Path Synopsis
Package httprouter is a trie based high performance HTTP request router.
Package httprouter is a trie based high performance HTTP request router.

Jump to

Keyboard shortcuts

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