Documentation
¶
Overview ¶
Package http RPC
Index ¶
- Constants
- func BadRequest(ctx *gin.Context, err error)
- func Fail(ctx *gin.Context, err error)
- func New(conf *Config, log log.Logger, flag bool, handler http.Handler) transport.Server
- func Success(ctx *gin.Context, data interface{})
- type Base
- func (b *Base) Delete(ctx context.Context, url string, param interface{}, data interface{}, ...) (err error)
- func (b *Base) Get(ctx context.Context, url string, param interface{}, data interface{}, ...) (err error)
- func (b *Base) Post(ctx context.Context, url string, param interface{}, data interface{}, ...) (err error)
- func (b *Base) Put(ctx context.Context, url string, param interface{}, data interface{}, ...) (err error)
- func (b *Base) Timeout() time.Duration
- func (b *Base) Url() string
- type BaseRequest
- type Config
- type ExtendAttrsEntity
- type ExtendAttrsParam
- type ListResponse
- type Option
- type PageResponse
- type Response
- type Search
Constants ¶
View Source
const NewlineTag = "<\\br>"
NewlineTag 换行符
View Source
const (
// URL 服务地址
URL = "https://127.0.0.1"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base RPC基础
func (*Base) Delete ¶
func (b *Base) Delete(ctx context.Context, url string, param interface{}, data interface{}, op ...uh.Option) (err error)
Delete DELETE
func (*Base) Get ¶
func (b *Base) Get(ctx context.Context, url string, param interface{}, data interface{}, op ...uh.Option) (err error)
Get GET
func (*Base) Post ¶
func (b *Base) Post(ctx context.Context, url string, param interface{}, data interface{}, op ...uh.Option) (err error)
Post POST
type BaseRequest ¶
type BaseRequest struct { // 页, 默认值 1 PageNum int32 `form:"pageNum,default=1" json:"pageNum,default=1" default:"1"` // 页码,默认值 30 PageSize int32 `form:"pageSize,default=30" json:"pageSize,default=30" default:"30"` // 排序字段 SortField string `form:"sortField,default=id" json:"sortField,default=id" default:"id"` // 排序的方式,asc/desc SortOrder string `form:"sortOrder,default=asc" json:"sortOrder,default=asc" default:"asc"` // 排除Total ExclusiveTotal bool `json:"exclusiveTotal" example:"false"` // 排除List ExclusiveList bool `json:"exclusiveList" example:"false"` // Search 搜索条件 Search []Search `form:"search" json:"search"` }
type Config ¶
type Config struct { Network string `json:"network,omitempty"` Addr string `json:"addr,omitempty"` Timeout int32 `json:"timeout,omitempty"` // 模式 release/debug Model string `json:"model,omitempty"` // 开启swag EnableSwag bool `json:"enable_swag,omitempty"` // 开启pprof EnablePprof bool `json:"enable_pprof,omitempty"` }
Config 配置
func (*Config) GetEnablePprof ¶
func (*Config) GetEnableSwag ¶
func (*Config) GetNetwork ¶
func (*Config) GetTimeout ¶
type ExtendAttrsEntity ¶
type ExtendAttrsEntity struct {
ExtendAttrs map[string]interface{} `json:"extendAttrs" binding:"omitempty"`
}
ExtendAttrsEntity 扩展属性
type ExtendAttrsParam ¶
type ExtendAttrsParam struct {
ExtendAttrs map[string]interface{} `json:"extendAttrs" binding:"omitempty"`
}
ExtendAttrsParam 扩展属性
type ListResponse ¶
type ListResponse struct {
// 数据
List interface{} `json:"list"`
}
ListResponse 列表返回结构
type PageResponse ¶
type PageResponse struct { // 数据 List interface{} `json:"list"` // 页码 PageNum int32 `json:"pageNum"` // 每页数量 PageSize int32 `json:"pageSize"` // 总数 Total int32 `json:"total"` }
PageResponse 列表返回结构
Click to show internal directories.
Click to hide internal directories.