Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig interface { AutoMigrate() bool Env() string Listen() ListenConfig MySQL() MySQLConfig }
type AppServices ¶
type AppServices interface { Login() LoginService JWT() JWTService }
type JWTGenerateResult ¶
type JWTService ¶
type JWTService interface { // Generate Create and sign a token for a given user. Generate(user *models.User) (JWTGenerateResult, error) // Validate Securely validate a token string, returning the relevant parsed JWT data. // // If JWTValidateResult is nil, validation has failed for the token. If err is not nil, Validate(token string) (JWTValidateResult, error) }
type JWTValidateResult ¶
type ListenConfig ¶
type LoginResult ¶
type LoginService ¶
type LoginService interface {
Login(email, password string) (*LoginResult, error)
}
type MySQLConfig ¶
type RequestContext ¶
type RequestContext interface { // ID The unique request ID as an UUID. ID() uuid.UUID // App The top-level application instance, which provides access to application services and configuration. App() App // Config Read application-level configuration. Config() AppConfig // Services Access the different services available to the application. Services() AppServices // Dao Access the different data-access-objects available to the application. Dao() AppDaos // Logger The unique, per-handler logger for the request. Logger() *zap.Logger // Req The raw http.Request object. Req() *http.Request // Context The request context. Context() context.Context // Authenticated Whether the current request has valid auth data. Authenticated() bool // IsUser Whether the current request is authorized for user access. IsUser() bool // IsAdmin Whether the current request is authorized for admin access. IsAdmin() bool // Token Return the JWT token if the current request has a valid one. Token() *jwt.Token // Claims Return the JWT claims if the current request has valid JWT. Claims() *auth.JWTClaims // JSON Unmarshal the JSON request body. JSON(dest interface{}) error // JSONV Unmarshal the JSON request body and run validator.Validate on it. JSONV(dest interface{}) error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.