schema

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	InQuery = 0
	InBody  = 1
)

Variables

View Source
var (

	//DefaultInterval is default refresh interval time
	DefaultInterval = 30 * time.Second
	//DefaultExpireTime is default expire time
	DefaultExpireTime = 0 * time.Second
)

Functions

func CovertSwaggerMethordToLocalMethord

func CovertSwaggerMethordToLocalMethord(schema *registry.SchemaContent, src *registry.MethodInfo, dst *DefMethod)

CovertSwaggerMethordToLocalMethord is a function to convert swagger method to local method

func GetSvcByInterface

func GetSvcByInterface(interfaceName string) *registry.MicroService

GetSvcByInterface is a function to get service by interface name

func GetSvcNameByInterface

func GetSvcNameByInterface(interfaceName string) string

GetSvcNameByInterface is a function to get service name by interface

Types

type DefField

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

DefField is a struct

type DefMethod

type DefMethod struct {
	Path     string //  样例: /test/StringArray 需要是包含basepath的URL
	OperaID  string
	Paras    []MethParam             //key 参数名称
	Verb     string                  // get post ...
	Responds map[string]*MethRespond //key 为返回码 200 ,404...
	// contains filtered or unexported fields
}

DefMethod is a struct

func GetMethodByInterface

func GetMethodByInterface(interfaceName string, operateID string) *DefMethod

GetMethodByInterface is a function to get method from interface name

func GetMethodInfoSchemaByURL

func GetMethodInfoSchemaByURL(schema *registry.SchemaContent, verb string, url string) *DefMethod

GetMethodInfoSchemaByURL is a function to get method info schema from URl

func GetSchemaMethodBySvcURL

func GetSchemaMethodBySvcURL(svcName string, env string, ver string, app string, verb string, url string) (*registry.SchemaContent, *DefMethod)

GetSchemaMethodBySvcURL is a function to get schema method from URl

func (*DefMethod) GetParamNameAndWhere

func (this *DefMethod) GetParamNameAndWhere(indx int) (string, int)

GetParamNameAndWhere is a method to get parameter name

func (*DefMethod) GetParamSchema

func (this *DefMethod) GetParamSchema(indx int) *MethParam

GetParamSchema is a method to get parameter schema

func (*DefMethod) GetRspSchema

func (this *DefMethod) GetRspSchema(status int) *MethRespond

GetRspSchema is a method to get response schema

type DefType

type DefType struct {
	JvmClsName string
	// contains filtered or unexported fields
}

DefType 契约definitions字段里定义的类型定义

func GetDefTypeFromDef

func GetDefTypeFromDef(defs map[string]registry.Definition, ref string) DefType

GetDefTypeFromDef is a function to get defintion type

type InterfaceSchema

type InterfaceSchema struct {
	SvcName     string
	JavaClsName string
	BasePath    string
	Version     string
	AppId       string
	ServiceId   string
	// contains filtered or unexported fields
}

InterfaceSchema is a struct

type Job

type Job struct {
	Fn   JobFunc
	Next time.Time
}

Job is a struct

type JobFunc

type JobFunc func()

JobFunc is a type of func()

type MethParam

type MethParam struct {
	Name            string            //参数名称
	Dtype           string            //参数类型
	AdditionalProps map[string]string //附加参数,如果是Dtype是map,则在这里定义value类型
	Items           map[string]string //当Dtype为array时使用
	Required        bool              //是否必需
	Where           string            //存储位置  query or body
	Indx            int
	ObjRef          DefType
}

MethParam is a struct

type MethRespond

type MethRespond struct {
	Status string // 200 404...
	DType  string
	ObjRef DefType
}

MethRespond is a struct

type Queue

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

Queue is a struct

func (*Queue) Pop

func (q *Queue) Pop() Job

Pop is a method to get next job

func (*Queue) Push

func (q *Queue) Push(x Job)

Push is a method to add new job

func (*Queue) Top

func (q *Queue) Top() Job

Top is a method to get then latest job

Jump to

Keyboard shortcuts

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