eel

package module
v0.0.0-...-25d1615 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 28 Imported by: 92

README

eel

a simple & fast RESTful micro-service framework

Documentation

Index

Constants

View Source
const SALT string = "030e2cf548cf9da683e340371d1a74ee"
View Source
const SERVICE_MODE_CRON = "cron"
View Source
const SERVICE_MODE_EVENT = "event"
View Source
const SERVICE_MODE_REST = "rest"

Variables

View Source
var AREA = make(map[string]map[string]interface{})
View Source
var MockPaginate = paginate.MockPaginate
View Source
var Paginate = paginate.Paginate
View Source
var Runtime = config.Runtime
View Source
var Tracer = tracing.Tracer

Functions

func Decimal

func Decimal(value float64) float64

func DecodeJWT

func DecodeJWT(jwtToken string) (*simplejson.Json, error)

func EncodeJWT

func EncodeJWT(data Map) string

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 GetServiceMode

func GetServiceMode() string

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 ParseTime

func ParseTime(strTime string) time.Time

func ParseUserIdFromJwtData

func ParseUserIdFromJwtData(js *simplejson.Json) (int, int, error)

func ParseUserIdFromJwtToken

func ParseUserIdFromJwtToken(jwtToken string) (int, int, error)

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 Strftime

func Strftime(t *time.Time, f string) string

Strftime formats time.Date according to the directives in the given format string. The directives begins with a percent (%) character.

func ToJsonString

func ToJsonString(obj interface{}) string

Types

type Area

type Area struct {
	Province *Province
	City     *City
	District *District
}

type AreaService

type AreaService struct {
	ServiceBase
}

func NewAreaService

func NewAreaService() *AreaService

func (*AreaService) GetAreaByCode

func (this *AreaService) GetAreaByCode(code string) *Area

GetAreaByCode 根据area code(320104)获取area

func (*AreaService) GetAreaByName

func (this *AreaService) GetAreaByName(name string) *Area

GetAreaByName 根据area name(北京市 北京市 东城区)获得area

func (*AreaService) GetCitiesByIds

func (this *AreaService) GetCitiesByIds(ids []string) []*City

func (*AreaService) GetCitiesByNames

func (this *AreaService) GetCitiesByNames(names []string) []*City

func (*AreaService) GetCitiesForProvince

func (this *AreaService) GetCitiesForProvince(provinceId string) []*City

func (*AreaService) GetCityById

func (this *AreaService) GetCityById(id string) *City

func (*AreaService) GetCityByName

func (this *AreaService) GetCityByName(name string) *City

func (*AreaService) GetDistrictById

func (this *AreaService) GetDistrictById(id string) *District

func (*AreaService) GetDistrictByName

func (this *AreaService) GetDistrictByName(cityId string, name string) *District

District相关api

func (*AreaService) GetDistrictsByIds

func (this *AreaService) GetDistrictsByIds(ids []string) []*District

func (*AreaService) GetDistrictsByNames

func (this *AreaService) GetDistrictsByNames(cityId string, names []string) []*District

func (*AreaService) GetDistrictsForCity

func (this *AreaService) GetDistrictsForCity(cityId string) []*District

func (*AreaService) GetProvinceById

func (this *AreaService) GetProvinceById(id string) *Province

func (*AreaService) GetProvinceByName

func (this *AreaService) GetProvinceByName(name string) *Province

func (*AreaService) GetProvinces

func (this *AreaService) GetProvinces() []*Province

func (*AreaService) GetProvincesByIds

func (this *AreaService) GetProvincesByIds(ids []string) []*Province

func (*AreaService) GetProvincesByNames

func (this *AreaService) GetProvincesByNames(names []string) []*Province

func (*AreaService) GetRawData

func (this *AreaService) GetRawData() map[string]map[string]interface{}

type BoolOption

type BoolOption = map[string]bool

type City

type City struct {
	Id         string
	ProvinceId string
	Name       string
	Districts  []*District
}

func NewCity

func NewCity(id string, name string) *City

type Context

type Context = handler.Context

export inner type

type DeletableModel

type DeletableModel = db.DeletableModel

type District

type District struct {
	Id     string
	CityId string
	Name   string
}

func NewDistrict

func NewDistrict(id string, name string) *District

type DummyLock

type DummyLock struct {
}

DummyLock 空的锁引擎

func (*DummyLock) Lock

func (this *DummyLock) Lock(key string) (*redsync.Mutex, error)

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 ILock

type ILock interface {
	Lock(key string) (*redsync.Mutex, error)
}
var Lock ILock //暴露的锁

type IModel

type IModel interface {
	TableName() string
}

type INextPageInfo

type INextPageInfo = paginate.INextPageInfo

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 = paginate.PageInfo

type PaginateResult

type PaginateResult = paginate.PaginateResult

type Province

type Province struct {
	Id     string
	Name   string
	Cities []*City
}

func NewProvince

func NewProvince(id string, name string) *Province

func (*Province) IsDGC

func (this *Province) IsDGC() bool

IsDGC 是否是直辖市

type RedisLock

type RedisLock struct {
	// contains filtered or unexported fields
}

RedisLock 基于redis的锁引擎

func (*RedisLock) Lock

func (this *RedisLock) Lock(key string) (*redsync.Mutex, error)

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
}

type Timedelta

type Timedelta struct {
	Days, Seconds, Microseconds, Milliseconds, Minutes, Hours, Weeks time.Duration
}

Timedelta represents a duration between two dates. All fields are optional and default to 0. You can initialize any type of timedelta by specifying field values which you want to use.

func (*Timedelta) Abs

func (t *Timedelta) Abs() Timedelta

Abs returns the absolute value of t

func (*Timedelta) Add

func (t *Timedelta) Add(t2 *Timedelta) Timedelta

Add returns the Timedelta t+t2.

func (*Timedelta) Duration

func (t *Timedelta) Duration() time.Duration

Duration() returns time.Duration. time.Duration can be added to time.Date.

func (*Timedelta) String

func (t *Timedelta) String() string

String returns a string representing the Timedelta's duration in the form "72h3m0.5s".

func (*Timedelta) Subtract

func (t *Timedelta) Subtract(t2 *Timedelta) Timedelta

Subtract returns the Timedelta t-t2.

Directories

Path Synopsis
Package backoff implements backoff algorithms for retrying operations.
Package backoff implements backoff algorithms for retrying operations.
env
Package env is used to parse environment.
Package env is used to parse environment.
toolbox
Package toolbox healthcheck
Package toolbox healthcheck

Jump to

Keyboard shortcuts

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