Documentation ¶
Index ¶
- Variables
- func ExtractIds(array interface{}, idType string) []int
- func GetOrmFromContext(ctx context.Context) *gorm.DB
- func GetRegisteredModels() []interface{}
- func MakeErrorResponse(code int32, errCode string, errMsg string, innerErrMsgs ...string) *handler.RestResponse
- func MakeResponse(data interface{}) *handler.RestResponse
- func MapInt(fn IntMapFunc, array interface{}) []int
- func NewBusinessError(code string, msg string) *utils.BusinessError
- func NewResource(ctx context.Context) *rest_client.Resource
- func RegisterMiddleware(middleware handler.MiddlewareInterface)
- func RegisterModel(model interface{})
- func RegisterResource(resource handler.RestResourceInterface)
- func RunService()
- func ToJsonString(obj interface{}) string
- type APIServiceNextPageInfo
- type BoolOption
- type Context
- type DeletableModel
- type EntityBase
- type FillOption
- type IIDable
- type IModel
- type INextPageInfo
- type IntMapFunc
- type JWTMiddleware
- type Map
- type Middleware
- type Model
- type PageInfo
- type PaginateResult
- type RepositoryBase
- type Request
- type RestResource
- type Service
- type ServiceBase
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger *zap.SugaredLogger = log.Logger
View Source
var Runtime = config.Runtime
View Source
var Tracer = tracing.Tracer
Functions ¶
func ExtractIds ¶
ExtractIds 从objs中获取id,组成id的集合
func GetRegisteredModels ¶
func GetRegisteredModels() []interface{}
func MakeErrorResponse ¶
func MakeResponse ¶
func MakeResponse(data interface{}) *handler.RestResponse
func MapInt ¶
func MapInt(fn IntMapFunc, array interface{}) []int
Map maps the function onto the array
func NewBusinessError ¶
func NewBusinessError(code string, msg string) *utils.BusinessError
func NewResource ¶
func NewResource(ctx context.Context) *rest_client.Resource
func RegisterMiddleware ¶
func RegisterMiddleware(middleware handler.MiddlewareInterface)
func RegisterModel ¶
func RegisterModel(model interface{})
func RegisterResource ¶
func RegisterResource(resource handler.RestResourceInterface)
func RunService ¶
func RunService()
func ToJsonString ¶
func ToJsonString(obj interface{}) string
Types ¶
type APIServiceNextPageInfo ¶
Mobile模式的分页结果
func (APIServiceNextPageInfo) ToMap ¶
func (this APIServiceNextPageInfo) ToMap() map[string]interface{}
type BoolOption ¶
type DeletableModel ¶
type DeletableModel = db.DeletableModel
type EntityBase ¶
type FillOption ¶
type INextPageInfo ¶
type INextPageInfo interface {
ToMap() map[string]interface{}
}
INextPageInfo
func MockPaginate ¶
func MockPaginate(itemCount int64, page *PageInfo) INextPageInfo
MockPaginate 模拟进行分页
func NewPaginateResultFromData ¶
func NewPaginateResultFromData(js *simplejson.Json) INextPageInfo
type IntMapFunc ¶
type IntMapFunc func(interface{}) int
type Middleware ¶
type Middleware = handler.Middleware
type PageInfo ¶
PageInfo 指示当前查询的数据的page信息
func ExtractPageInfoFromRequest ¶
ExtractPageInfoFromRequest 从Request中抽取page信息
func (*PageInfo) IsApiServerMode ¶
type PaginateResult ¶
type PaginateResult struct { HasPrev bool HasNext bool HasHead bool HasTail bool Prev int Next int CurPage int MaxPage int TotalCount int64 DisplayPages []int Offset int CountInPage int }
PaginateResult 分页的结果
func (PaginateResult) ToMap ¶
func (this PaginateResult) ToMap() map[string]interface{}
type RepositoryBase ¶
type RestResource ¶
type RestResource = handler.RestResource
type Service ¶
type Service struct { Handler *router.RestResourceRegister Server *http.Server }
func NewService ¶
func NewService() *Service
type ServiceBase ¶
Click to show internal directories.
Click to hide internal directories.