Documentation ¶
Index ¶
- Constants
- Variables
- func BoolAvailablePassword(pwd string) bool
- func BoolErrorAppType(appType string) bool
- func BoolErrorClientType(clientType string) bool
- func BoolErrorDeviceType(deviceType string) bool
- func BoolErrorInternalClientType(clientType string) bool
- func CheckAdminUserHasRole(userRoles []string, needRoles map[string]interface{}) bool
- func CheckParamEmpty(str string) error
- func ErrorResponse(ctx echo.Context, err error) error
- func GetAppType(ctx echo.Context) string
- func GetAppVersion(ctx echo.Context) string
- func GetClientIp(ctx echo.Context) string
- func GetClientType(ctx echo.Context) string
- func GetDeviceID(req *http.Request) string
- func GetDeviceType(ctx echo.Context) string
- func GetHeaderXDevicetype(ctx echo.Context) string
- func GetHeaderXMarket(ctx echo.Context) string
- func GetHeaderXOwner(ctx echo.Context) string
- func GetIdFromPath(ctx echo.Context) (int64, error)
- func GetLanguage(ctx echo.Context) string
- func GetLimit(ctx echo.Context, defaultLimit int64) int64
- func GetOpenId(ctx echo.Context) string
- func GetParamFromPath(ctx echo.Context, param string) (int64, error)
- func GetPlatformFromHeader(ctx echo.Context) string
- func GetSessionKey(ctx echo.Context) string
- func GetTaotieDeviceID(req *http.Request) string
- func GetUserId(ctx echo.Context) int64
- func GetUserRoles(ctx echo.Context) []string
- func GetUserRolesStr(ctx echo.Context) string
- func MicroCtxFromEcho(ec echo.Context) context.Context
- func RandomHex() string
- func RandomInt() int64
- func SetClientIp(ctx echo.Context, ip string)
- func SuccessResponse(ctx echo.Context, data interface{}, fields ...string) error
- func SuccessResponseNoETag(ctx echo.Context, data interface{}, fields ...string) error
- func TransferClientType(clientType string) string
- type Response
Constants ¶
View Source
const ( RequestHeaderClientIP = "X-Forwarded-For" RequestHeaderTokenName = "X-Solar-Token" RequestHeaderApp = "X-Solar-App" RequestHeaderPlatform = "X-Solar-Platform" RequestHeaderClientType = "X-Client-Type" RequestHeaderDeviceID = "X-Device-ID" RequestHeaderTaotieDeviceID = "X-Taotie-Device-ID" RequestHeaderLanguage = "X-Language" RequestHeaderAppOffset_OWNER = 0 RequestHeaderAppOffset_DEVICETYPE = 1 RequestHeaderAppOffset_MARKET = 4 ResponseHeaderTraceID = "X-Solar-Trace-ID" InternalRolesKey = "admin_user_role" UserIDKey = "user_id" AppTypeKey = "app_type" OpenIdKey = "open_id" SessionKey = "session_key" ExpirationKey = "expiration" DeviceTypeKey = "device_type" AppVersionKey = "app_version" ClientTypeKey = "client_type" ClientIp = "clientip" TraceIDHexKey = "trace_id_hex" SpanIDKey = "span_id" ResponseCodeKey = "response_code" InstIdKey = "inst_id" )
Variables ¶
View Source
var (
RoleListRoles = map[string]interface{}{}
)
Functions ¶
func BoolAvailablePassword ¶
func BoolErrorAppType ¶
func BoolErrorClientType ¶
func BoolErrorDeviceType ¶
func CheckAdminUserHasRole ¶
func CheckParamEmpty ¶
CheckParamEmpty checks if parameter is empty.
func GetAppType ¶
GetAppType extracts app_type from context, login require 时写入
func GetAppVersion ¶
GetAppVersion extracts app_version from context, login require 时写入
func GetClientIp ¶
func GetClientType ¶
GetClientType extracts client_type from context, login require 时写入
func GetDeviceID ¶
GetDeviceID fetches device ID from request header.
func GetDeviceType ¶
GetDeviceType extracts device_type from context, login require 时写入
func GetHeaderXDevicetype ¶
func GetHeaderXMarket ¶
func GetHeaderXOwner ¶
func GetLanguage ¶
func GetParamFromPath ¶
GetParamFromPath 从url中获取自定义int参数
func GetPlatformFromHeader ¶
func GetSessionKey ¶
GetSessionKey extracts session_key from context, login require 时写入
func GetTaotieDeviceID ¶
GetTaotieDeviceID fetches taotie device ID from request header.
func GetUserRoles ¶
GetUserRoles extracts roles from context
func GetUserRolesStr ¶
func MicroCtxFromEcho ¶
MicroCtxFromEcho transforms echo.Context to micro context and add trace ID.
func SetClientIp ¶
func SuccessResponse ¶
* 正确返回
func SuccessResponseNoETag ¶
func TransferClientType ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.