Documentation
¶
Index ¶
- Constants
- func CopyHttpRequest(r *http.Request) *http.Request
- func GenerateDefaultStringTemplate(templateText string) (string, error)
- func GenerateDefaultTemplate(templateText string) ([]byte, error)
- func GenerateTemplate(templateText string, templateData interface{}, params map[string]interface{}) ([]byte, error)
- func MustGetJBody(c *gin.Context) string
- func NewHttpRequestWithHeader(ctx context.Context, method string, url string, body []byte, ...) ([]byte, error)
- func NewHttpServer(desc *httpServerDescriptor) *httpServer
- func ParamValue(param map[string]struct{}, jBody string) (map[string]interface{}, error)
- func ParametersFromStr(str string, regExpr *regexp.Regexp) map[string]struct{}
- func ParseProtoFile(importPath []string, filePath []string) ([]*desc.FileDescriptor, error)
- func ParseProtoFileFromProtoset(protosetPath string) (*desc.FileDescriptor, error)
- func ParseServerMethodsFromFileDescriptor(fileDesc ...*desc.FileDescriptor) *gRpcServer
- func ParseServerMethodsFromProto(importPath []string, filePath []string) (*gRpcServer, error)
- func ParseServerMethodsFromProtoset(filePath string) (*gRpcServer, error)
- func ReplaceParamValue(param map[string]struct{}, jBody string, originStr string) (string, error)
- func SetOutputFunc(schemaList GrpcServerDescriptionList, gRpcServ *gRpcServer) error
- func ValidateGrpcServiceInputAndOutput(schemaList GrpcServerDescriptionList, gRpcServ *gRpcServer) error
- func ValuableBoolExpression(expressionStr string) (bool, error)
- type CallbackDescription
- type CallbackDescriptionBase
- type CallbackRequest
- type GrpcMethodDescription
- type GrpcMethodDescriptionList
- type GrpcServerDescription
- type GrpcServerDescriptionList
- type HttpCallbackDescription
- type HttpCallbackDescriptionList
- type MockGrpcResponse
- type ResponseConditionDescription
- type ResponseConditionDescriptionList
- type SchemaDescription
- type SchemaDescriptionBase
- type ServerDescriptionInterface
- type ServerKind
Constants ¶
View Source
const ( LeftDelim = "{{" RightDelim = "}}" )
View Source
const ( HTTPAnyMethod = "ANY" HTTPGETMethod = http.MethodGet HTTPPOSTMethod = http.MethodPost HTTPDELETEMethod = http.MethodDelete HTTPPATCHMethod = http.MethodPatch HTTPPUTMethod = http.MethodPut )
Variables ¶
This section is empty.
Functions ¶
func GenerateDefaultTemplate ¶
func GenerateTemplate ¶
func MustGetJBody ¶
func NewHttpRequestWithHeader ¶ added in v0.0.3
func NewHttpServer ¶
func NewHttpServer(desc *httpServerDescriptor) *httpServer
func ParamValue ¶
func ParametersFromStr ¶
func ParseProtoFile ¶
func ParseProtoFile(importPath []string, filePath []string) ([]*desc.FileDescriptor, error)
func ParseProtoFileFromProtoset ¶
func ParseProtoFileFromProtoset(protosetPath string) (*desc.FileDescriptor, error)
func ParseServerMethodsFromFileDescriptor ¶
func ParseServerMethodsFromFileDescriptor(fileDesc ...*desc.FileDescriptor) *gRpcServer
func ReplaceParamValue ¶ added in v0.0.3
func SetOutputFunc ¶
func SetOutputFunc(schemaList GrpcServerDescriptionList, gRpcServ *gRpcServer) error
func ValidateGrpcServiceInputAndOutput ¶
func ValidateGrpcServiceInputAndOutput(schemaList GrpcServerDescriptionList, gRpcServ *gRpcServer) error
func ValuableBoolExpression ¶
Types ¶
type CallbackDescription ¶
type CallbackDescription struct { CallbackDescriptionBase Request []CallbackRequest `yaml:"request" json:"request"` }
func (*CallbackDescription) UnmarshalYAML ¶
func (s *CallbackDescription) UnmarshalYAML(unmarshal func(interface{}) error) error
type CallbackDescriptionBase ¶
type CallbackDescriptionBase struct {
Kind ServerKind `yaml:"kind" json:"kind"`
}
type CallbackRequest ¶
type CallbackRequest interface {
MakRequest() error
}
type GrpcMethodDescription ¶
type GrpcMethodDescription struct { Name string `yaml:"name" json:"name"` DefaultResponse string `yaml:"defaultResponse" json:"defaultResponse"` DefaultMetaData map[string]string `yaml:"defaultMetaData"` Conditions ResponseConditionDescriptionList `yaml:"conditions" json:"conditions"` Parameters map[string]string `yaml:"-" json:"-"` HttpCallback HttpCallbackDescriptionList `yaml:"httpCallback"` }
func (*GrpcMethodDescription) Validate ¶
func (m *GrpcMethodDescription) Validate() error
type GrpcMethodDescriptionList ¶
type GrpcMethodDescriptionList []*GrpcMethodDescription
func (GrpcMethodDescriptionList) Validate ¶
func (m GrpcMethodDescriptionList) Validate() error
type GrpcServerDescription ¶
type GrpcServerDescription struct { Name string `yaml:"name" json:"name"` Methods GrpcMethodDescriptionList `yaml:"methods" json:"methods"` }
func (*GrpcServerDescription) GetMethod ¶
func (g *GrpcServerDescription) GetMethod(methodName string) (*GrpcMethodDescription, error)
func (*GrpcServerDescription) Validate ¶
func (g *GrpcServerDescription) Validate() error
type GrpcServerDescriptionList ¶
type GrpcServerDescriptionList []*GrpcServerDescription
func (GrpcServerDescriptionList) GetMethod ¶
func (s GrpcServerDescriptionList) GetMethod(servName string, methodName string) (*GrpcMethodDescription, error)
func (GrpcServerDescriptionList) Validate ¶
func (s GrpcServerDescriptionList) Validate() error
type HttpCallbackDescription ¶
type HttpCallbackDescription struct { Method string `yaml:"method"` URL string `yaml:"url" json:"url"` Header map[string]string `yaml:"header" json:"header"` Body string `yaml:"body" json:"body"` DelayTime int64 `yaml:"delayTime" json:"delayTime"` // contains filtered or unexported fields }
func (*HttpCallbackDescription) Validate ¶ added in v0.0.3
func (h *HttpCallbackDescription) Validate() error
type HttpCallbackDescriptionList ¶ added in v0.0.3
type HttpCallbackDescriptionList []*HttpCallbackDescription
func (HttpCallbackDescriptionList) Validate ¶ added in v0.0.3
func (c HttpCallbackDescriptionList) Validate() error
type MockGrpcResponse ¶
type MockGrpcResponse struct {
// contains filtered or unexported fields
}
type ResponseConditionDescriptionList ¶
type ResponseConditionDescriptionList []*ResponseConditionDescription
type SchemaDescription ¶
type SchemaDescription struct { SchemaDescriptionBase Server ServerDescriptionInterface `yaml:"servers" json:"servers"` }
func LoadSchemaFromYaml ¶
func LoadSchemaFromYaml(filePath string) (*SchemaDescription, error)
func (*SchemaDescription) Unmarshal ¶
func (s *SchemaDescription) Unmarshal(d []byte) error
func (*SchemaDescription) UnmarshalYAML ¶
func (s *SchemaDescription) UnmarshalYAML(unmarshal func(interface{}) error) error
func (SchemaDescription) Validate ¶
func (s SchemaDescription) Validate() error
func (SchemaDescription) ValidateAndStartServer ¶
func (s SchemaDescription) ValidateAndStartServer() error
type SchemaDescriptionBase ¶
type SchemaDescriptionBase struct { Kind ServerKind `yaml:"kind" json:"kind"` Port int `yaml:"port" json:"port"` }
type ServerKind ¶
type ServerKind string
const ( GRPC ServerKind = "grpc" HTTP ServerKind = "http" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.