Documentation ¶
Index ¶
- Constants
- Variables
- func GlobalTrace() echo.MiddlewareFunc
- func Init(initializers ...Initializer)
- func RequestLogger() echo.MiddlewareFunc
- type Context
- func (c *Context) BindValidParams(req interface{}) (err error)
- func (c *Context) CustomFailMsg(err error, code int, msg string) error
- func (c *Context) Fail(err error, data ...interface{}) error
- func (c *Context) FailWithArray(err error) error
- func (c *Context) FailWithObject(err error) error
- func (c *Context) FailWithString(err error) error
- func (c *Context) Paginated(page page.Page) error
- func (c *Context) Pagination() paging.Pageable
- func (c *Context) RequestId() string
- func (c *Context) Success(data ...interface{}) error
- func (c *Context) TODO() ctx.Context
- func (c *Context) TraceId() string
- func (c *Context) ValidateFieldErrors(handler interface{}) *errors.FieldErrors
- func (c *Context) WithValue(key string, val interface{})
- type Group
- type Handler
- type HandlerFunc
- type Initializer
- type MiddlewareFunc
- type Pagination
- type Response
- type Router
- type Service
- func (s *Service) Client() client.Client
- func (s *Service) GetEcho() *echo.Echo
- func (s *Service) Name() string
- func (s *Service) Options() micro.Options
- func (s *Service) Register(handler Handler)
- func (s *Service) Run() error
- func (s *Service) Server() server.Server
- func (s *Service) String() string
- func (s *Service) Subscribe(topic string, h interface{})
- type Validatable
- type Validator
Constants ¶
View Source
const ( HeaderXTraceID = "X-Trace-Id" DaeBaggageHeaderPrefix = "daectx-" )
Variables ¶
View Source
var Lang map[string]map[int32]string
Functions ¶
func GlobalTrace ¶
func GlobalTrace() echo.MiddlewareFunc
func Init ¶
func Init(initializers ...Initializer)
Types ¶
type Context ¶
type Context struct {
echo.Context
}
func (*Context) BindValidParams ¶
BindValidParams 绑定参数+验证
func (*Context) CustomFailMsg ¶
CustomFailMsg 自定义错误返回
func (*Context) FailWithArray ¶
FailWithArray data为[]
func (*Context) FailWithObject ¶
FailWithObject data为{}
func (*Context) FailWithString ¶
FailWithString data为空字符串
func (*Context) Pagination ¶
func (*Context) ValidateFieldErrors ¶
func (c *Context) ValidateFieldErrors(handler interface{}) *errors.FieldErrors
type Group ¶
type Group interface { GET(path string, handler HandlerFunc, middleware ...MiddlewareFunc) POST(path string, handler HandlerFunc, middleware ...MiddlewareFunc) PUT(path string, handler HandlerFunc, middleware ...MiddlewareFunc) DELETE(path string, handler HandlerFunc, middleware ...MiddlewareFunc) HEAD(path string, handler HandlerFunc, middleware ...MiddlewareFunc) PATCH(path string, handler HandlerFunc, middleware ...MiddlewareFunc) Group(prefix string, middleware ...MiddlewareFunc) Group }
type HandlerFunc ¶
type Initializer ¶
type Initializer func() error
type MiddlewareFunc ¶
type Pagination ¶
type Response ¶
type Response struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` Errors errors.FieldErrors `json:"errors,omitempty"` Path string `json:"path"` TraceID string `json:"trace_id,omitempty"` Pagination *Pagination `json:"pagination,omitempty"` }
type Router ¶
type Router interface { GET(path string, handler HandlerFunc, middleware ...MiddlewareFunc) POST(path string, handler HandlerFunc, middleware ...MiddlewareFunc) PUT(path string, handler HandlerFunc, middleware ...MiddlewareFunc) DELETE(path string, handler HandlerFunc, middleware ...MiddlewareFunc) HEAD(path string, handler HandlerFunc, middleware ...MiddlewareFunc) PATCH(path string, handler HandlerFunc, middleware ...MiddlewareFunc) Group(prefix string, middleware ...MiddlewareFunc) Group Static(prefix, root string) }
type Validatable ¶
type Validatable interface {
Validate() error
}
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) RegisterValidation ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.