Documentation
¶
Index ¶
- Constants
- type ApiHandlerFunc
- type Context
- func (c *Context) ClientPort() uint16
- func (c *Context) GetClientLocale() string
- func (c *Context) GetClientTimezoneOffset() (int16, error)
- func (c *Context) GetCurrentUid() int64
- func (c *Context) GetRequestId() string
- func (c *Context) GetResponseError() *errs.Error
- func (c *Context) GetTextualToken() string
- func (c *Context) GetTokenClaims() *UserTokenClaims
- func (c *Context) SetRequestId(requestId string)
- func (c *Context) SetResponseError(error *errs.Error)
- func (c *Context) SetTextualToken(token string)
- func (c *Context) SetTokenClaims(claims *UserTokenClaims)
- type DataHandlerFunc
- type DecimalSeparator
- type DigitGroupingSymbol
- type DigitGroupingType
- type ImageHandlerFunc
- type MiddlewareHandlerFunc
- type ProxyHandlerFunc
- type TokenType
- type UserTokenClaims
- func (c *UserTokenClaims) GetAudience() (jwt.ClaimStrings, error)
- func (c *UserTokenClaims) GetExpirationTime() (*jwt.NumericDate, error)
- func (c *UserTokenClaims) GetIssuedAt() (*jwt.NumericDate, error)
- func (c *UserTokenClaims) GetIssuer() (string, error)
- func (c *UserTokenClaims) GetNotBefore() (*jwt.NumericDate, error)
- func (c *UserTokenClaims) GetSubject() (string, error)
Constants ¶
const AcceptLanguageHeaderName = "Accept-Language"
AcceptLanguageHeaderName represents the header name of accept language
const ClientTimezoneOffsetHeaderName = "X-Timezone-Offset"
ClientTimezoneOffsetHeaderName represents the header name of client timezone offset
const RemoteClientPortHeader = "X-Real-Port"
RemoteClientPortHeader represents the header name of remote client source port
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiHandlerFunc ¶
ApiHandlerFunc represents the api handler function
type Context ¶
Context represents the request and response context
func WrapContext ¶
WrapContext returns a context wrapped by this file
func (*Context) ClientPort ¶ added in v0.5.0
func (*Context) GetClientLocale ¶ added in v0.4.0
GetClientLocale returns the client locale name
func (*Context) GetClientTimezoneOffset ¶
GetClientTimezoneOffset returns the client timezone offset
func (*Context) GetCurrentUid ¶
GetCurrentUid returns the current user uid by the current user token
func (*Context) GetRequestId ¶
GetRequestId returns the current request id
func (*Context) GetResponseError ¶
GetResponseError returns the response error
func (*Context) GetTextualToken ¶ added in v0.4.0
GetTextualToken returns the current user textual token
func (*Context) GetTokenClaims ¶
func (c *Context) GetTokenClaims() *UserTokenClaims
GetTokenClaims returns the current user token
func (*Context) SetRequestId ¶
SetRequestId sets the given request id to context
func (*Context) SetResponseError ¶
SetResponseError sets the response error
func (*Context) SetTextualToken ¶ added in v0.4.0
SetTextualToken sets the given user token to context
func (*Context) SetTokenClaims ¶
func (c *Context) SetTokenClaims(claims *UserTokenClaims)
SetTokenClaims sets the given user token to context
type DataHandlerFunc ¶
DataHandlerFunc represents the handler function that returns file data byte array and file name
type DecimalSeparator ¶ added in v0.5.0
type DecimalSeparator byte
DecimalSeparator represents the type of decimal separator
const ( DECIMAL_SEPARATOR_DEFAULT DecimalSeparator = 0 DECIMAL_SEPARATOR_DOT DecimalSeparator = 1 DECIMAL_SEPARATOR_COMMA DecimalSeparator = 2 DECIMAL_SEPARATOR_SPACE DecimalSeparator = 3 DECIMAL_SEPARATOR_INVALID DecimalSeparator = 255 )
Decimal Separator
func (DecimalSeparator) String ¶ added in v0.5.0
func (f DecimalSeparator) String() string
String returns a textual representation of the decimal separator enum
type DigitGroupingSymbol ¶ added in v0.5.0
type DigitGroupingSymbol byte
DigitGroupingSymbol represents the digit grouping symbol
const ( DIGIT_GROUPING_SYMBOL_DEFAULT DigitGroupingSymbol = 0 DIGIT_GROUPING_SYMBOL_DOT DigitGroupingSymbol = 1 DIGIT_GROUPING_SYMBOL_COMMA DigitGroupingSymbol = 2 DIGIT_GROUPING_SYMBOL_SPACE DigitGroupingSymbol = 3 DIGIT_GROUPING_SYMBOL_APOSTROPHE DigitGroupingSymbol = 4 DIGIT_GROUPING_SYMBOL_INVALID DigitGroupingSymbol = 255 )
Digit Grouping Symbol
func (DigitGroupingSymbol) String ¶ added in v0.5.0
func (f DigitGroupingSymbol) String() string
String returns a textual representation of the digit grouping symbol enum
type DigitGroupingType ¶ added in v0.5.0
type DigitGroupingType byte
DigitGroupingType represents digit grouping type
const ( DIGIT_GROUPING_TYPE_DEFAULT DigitGroupingType = 0 DIGIT_GROUPING_TYPE_NONE DigitGroupingType = 1 DIGIT_GROUPING_TYPE_THOUSANDS_SEPARATOR DigitGroupingType = 2 DIGIT_GROUPING_TYPE_INVALID DigitGroupingType = 255 )
Digit Grouping Type
func (DigitGroupingType) String ¶ added in v0.5.0
func (d DigitGroupingType) String() string
String returns a textual representation of the digit grouping type enum
type ImageHandlerFunc ¶ added in v0.5.0
ImageHandlerFunc represents the handler function that returns image byte array and content type
type MiddlewareHandlerFunc ¶
type MiddlewareHandlerFunc func(*Context)
MiddlewareHandlerFunc represents the middleware handler function
type ProxyHandlerFunc ¶ added in v0.3.0
type ProxyHandlerFunc func(*Context) (*httputil.ReverseProxy, *errs.Error)
ProxyHandlerFunc represents the reverse proxy handler function
type UserTokenClaims ¶
type UserTokenClaims struct {
UserTokenId string `json:"userTokenId"`
Uid int64 `json:"jti,string"`
Username string `json:"username,omitempty"`
Type TokenType `json:"type"`
IssuedAt int64 `json:"iat"`
ExpiresAt int64 `json:"exp"`
}
UserTokenClaims represents user token
func (*UserTokenClaims) GetAudience ¶ added in v0.3.0
func (c *UserTokenClaims) GetAudience() (jwt.ClaimStrings, error)
GetAudience returns the audience of this token
func (*UserTokenClaims) GetExpirationTime ¶ added in v0.3.0
func (c *UserTokenClaims) GetExpirationTime() (*jwt.NumericDate, error)
GetExpirationTime returns the expiration time of this token
func (*UserTokenClaims) GetIssuedAt ¶ added in v0.3.0
func (c *UserTokenClaims) GetIssuedAt() (*jwt.NumericDate, error)
GetIssuedAt returns the issue time of this token
func (*UserTokenClaims) GetIssuer ¶ added in v0.3.0
func (c *UserTokenClaims) GetIssuer() (string, error)
GetIssuer returns the issuer of this token
func (*UserTokenClaims) GetNotBefore ¶ added in v0.3.0
func (c *UserTokenClaims) GetNotBefore() (*jwt.NumericDate, error)
GetNotBefore returns the earliest valid time of this token
func (*UserTokenClaims) GetSubject ¶ added in v0.3.0
func (c *UserTokenClaims) GetSubject() (string, error)
GetSubject returns the subject of this token