Documentation ¶
Index ¶
- Constants
- Variables
- func Decimal(value float64) float64
- func DecodeJWT(jwtToken string) (*simplejson.Json, error)
- func EncodeJWT(data Map) string
- func ExtractIds(array interface{}, idType string) []int
- func GetOrmFromContext(ctx context.Context) *gorm.DB
- func GetRegisteredModels() []interface{}
- func GetServiceMode() string
- 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 ParseTime(strTime string) time.Time
- func ParseUserIdFromJwtData(js *simplejson.Json) (int, int, error)
- func ParseUserIdFromJwtToken(jwtToken string) (int, int, error)
- func RegisterMiddleware(middleware handler.MiddlewareInterface)
- func RegisterModel(model interface{})
- func RegisterResource(resource handler.RestResourceInterface)
- func RunService()
- func Strftime(t *time.Time, f string) string
- func ToJsonString(obj interface{}) string
- type Area
- type AreaService
- func (this *AreaService) GetAreaByCode(code string) *Area
- func (this *AreaService) GetAreaByName(name string) *Area
- func (this *AreaService) GetCitiesByIds(ids []string) []*City
- func (this *AreaService) GetCitiesByNames(names []string) []*City
- func (this *AreaService) GetCitiesForProvince(provinceId string) []*City
- func (this *AreaService) GetCityById(id string) *City
- func (this *AreaService) GetCityByName(name string) *City
- func (this *AreaService) GetDistrictById(id string) *District
- func (this *AreaService) GetDistrictByName(cityId string, name string) *District
- func (this *AreaService) GetDistrictsByIds(ids []string) []*District
- func (this *AreaService) GetDistrictsByNames(cityId string, names []string) []*District
- func (this *AreaService) GetDistrictsForCity(cityId string) []*District
- func (this *AreaService) GetProvinceById(id string) *Province
- func (this *AreaService) GetProvinceByName(name string) *Province
- func (this *AreaService) GetProvinces() []*Province
- func (this *AreaService) GetProvincesByIds(ids []string) []*Province
- func (this *AreaService) GetProvincesByNames(names []string) []*Province
- func (this *AreaService) GetRawData() map[string]map[string]interface{}
- type BoolOption
- type City
- type Context
- type DeletableModel
- type District
- type DummyLock
- type EntityBase
- type FillOption
- type IIDable
- type ILock
- type IModel
- type INextPageInfo
- type IntMapFunc
- type JWTMiddleware
- type Map
- type Middleware
- type Model
- type PageInfo
- type PaginateResult
- type Province
- type RedisLock
- type RepositoryBase
- type Request
- type RestResource
- type Service
- type ServiceBase
- type Timedelta
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 Logger *zap.SugaredLogger = log.Logger
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 ExtractIds ¶
ExtractIds 从objs中获取id,组成id的集合
func GetRegisteredModels ¶
func GetRegisteredModels() []interface{}
func GetServiceMode ¶
func GetServiceMode() string
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 ParseUserIdFromJwtData ¶
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 ¶
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 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 DeletableModel ¶
type DeletableModel = db.DeletableModel
type District ¶
func NewDistrict ¶
type EntityBase ¶
type FillOption ¶
type INextPageInfo ¶
type INextPageInfo = paginate.INextPageInfo
type IntMapFunc ¶
type IntMapFunc func(interface{}) int
type Middleware ¶
type Middleware = handler.Middleware
type PaginateResult ¶
type PaginateResult = paginate.PaginateResult
type Province ¶
func NewProvince ¶
type RedisLock ¶
type RedisLock struct {
// contains filtered or unexported fields
}
RedisLock 基于redis的锁引擎
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 ¶
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) Duration ¶
Duration() returns time.Duration. time.Duration can be added to time.Date.
Source Files ¶
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 |
Click to show internal directories.
Click to hide internal directories.