Documentation
¶
Index ¶
- func CORS() gin.HandlerFunc
- func CallerMiddleware(parser adapteraccount.TokenParser, database *gorm.DB) gin.HandlerFunc
- func ClientUpdateMiddleware(cfg *config.ClientUpdateConfig) gin.HandlerFunc
- func CompareVersions(left string, right string) int
- func Logger(whitelist ...string) gin.HandlerFunc
- func RequireCallerOrg() gin.HandlerFunc
- func ResponseRequestID() gin.HandlerFunc
- type ClientUpdateRequiredResponse
- type TokenParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORS ¶
func CORS() gin.HandlerFunc
func CallerMiddleware ¶
func CallerMiddleware(parser adapteraccount.TokenParser, database *gorm.DB) gin.HandlerFunc
CallerMiddleware parses the Authorization header via the injected TokenParser and stores the resulting Caller/Trace in the gin context.
func ClientUpdateMiddleware ¶ added in v0.1.13
func ClientUpdateMiddleware(cfg *config.ClientUpdateConfig) gin.HandlerFunc
ClientUpdateMiddleware blocks business APIs when a known client app is below the minimum supported version.
func CompareVersions ¶ added in v0.1.13
CompareVersions compares two dotted semantic versions.
func RequireCallerOrg ¶ added in v0.2.1
func RequireCallerOrg() gin.HandlerFunc
RequireCallerOrg 确保请求方已通过身份验证且归属于某个组织。 必须在 CallerMiddleware 之后注册,依赖其写入 gin.Context 的 Caller 信息。 验证失败时立即以 401 中止请求链,不进入后续 handler。
func ResponseRequestID ¶ added in v0.3.0
func ResponseRequestID() gin.HandlerFunc
ResponseRequestID adds the request correlation ID to JSON object responses.
Types ¶
type ClientUpdateRequiredResponse ¶ added in v0.1.13
type ClientUpdateRequiredResponse struct {
ForceUpdate bool `json:"force_update"`
App string `json:"app,omitempty"`
CurrentVersion string `json:"current_version,omitempty"`
MinSupportedVersion string `json:"min_supported_version,omitempty"`
LatestVersion string `json:"latest_version,omitempty"`
UpdateURL string `json:"update_url,omitempty"`
Message string `json:"message"`
}
ClientUpdateRequiredResponse describes why a client must update before continuing.
type TokenParser ¶ added in v0.3.0
type TokenParser = adapteraccount.TokenParser
TokenParser is an alias for account.TokenParser so callers in api/handler (which cannot import account directly due to import cycles) can reference the parser contract through this package.