eel

package module
v0.0.0-...-176c3f8 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2018 License: MIT Imports: 20 Imported by: 0

README

eel

a simple & fast RESTful micro-service framework

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Runtime = config.Runtime
View Source
var Tracer = tracing.Tracer

Functions

func ExtractIds

func ExtractIds(array interface{}, idType string) []int

ExtractIds 从objs中获取id,组成id的集合

func GetOrmFromContext

func GetOrmFromContext(ctx context.Context) *gorm.DB

func GetRegisteredModels

func GetRegisteredModels() []interface{}

func MakeErrorResponse

func MakeErrorResponse(code int32, errCode string, errMsg string, innerErrMsgs ...string) *handler.RestResponse

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

type APIServiceNextPageInfo struct {
	HasNext    bool
	NextFromId int64
}

Mobile模式的分页结果

func (APIServiceNextPageInfo) ToMap

func (this APIServiceNextPageInfo) ToMap() map[string]interface{}

type BoolOption

type BoolOption = map[string]bool

type Context

type Context = handler.Context

export inner type

type DeletableModel

type DeletableModel = db.DeletableModel

type EntityBase

type EntityBase struct {
	Ctx   context.Context
	Model interface{}
}

type FillOption

type FillOption = map[string]bool

type IIDable

type IIDable interface {
	GetId(idType string) int
}

type IModel

type IModel interface {
	TableName() string
}

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

func Paginate

func Paginate(db *gorm.DB, page *PageInfo, container interface{}) (INextPageInfo, error)

PaginateAndFill 进行分页,并获取填充数据

type IntMapFunc

type IntMapFunc func(interface{}) int

type JWTMiddleware

type JWTMiddleware = middleware.JWTMiddleware

export Middleware

type Map

type Map = handler.Map

type Middleware

type Middleware = handler.Middleware

type Model

type Model = db.Model

type PageInfo

type PageInfo struct {
	Page         int
	FromId       int
	CountPerPage int
	Mode         string
	Direction    string
}

PageInfo 指示当前查询的数据的page信息

func ExtractPageInfoFromRequest

func ExtractPageInfoFromRequest(ctx *handler.Context) *PageInfo

ExtractPageInfoFromRequest 从Request中抽取page信息

func (*PageInfo) Asc

func (self *PageInfo) Asc() *PageInfo

func (*PageInfo) Desc

func (self *PageInfo) Desc() *PageInfo

func (*PageInfo) IsApiServerMode

func (self *PageInfo) IsApiServerMode() bool

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 RepositoryBase struct {
	Ctx context.Context
}

type Request

type Request handler.Request

type RestResource

type RestResource = handler.RestResource

type Service

type Service struct {
	Handler *router.RestResourceRegister
	Server  *http.Server
}

func NewService

func NewService() *Service

type ServiceBase

type ServiceBase struct {
	Ctx context.Context
}

Directories

Path Synopsis
env
Package env is used to parse environment.
Package env is used to parse environment.

Jump to

Keyboard shortcuts

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