Documentation
¶
Index ¶
- Constants
- Variables
- func Cors() gin.HandlerFunc
- func DefaultDecompressHandle(c *gin.Context)
- func Gzip(level int, options ...Option) gin.HandlerFunc
- func Jwt() gin.HandlerFunc
- func MakeToken(claims *JWTClaims) (signedToken string, err error)
- func Refresh(token string) (newToken string, err error)
- func SignWithInfo(claims *JWTClaims) (token string, err error)
- func ToSignMethod(methodInt int) (sm jwt.SigningMethod)
- type Cli
- func (c *Cli) Explain(info string) *Cli
- func (c *Cli) Item(name string) *Cli
- func (c *Cli) Save() CliInput
- func (c *Cli) SaveExplain() bool
- func (c *Cli) SetBoolDefault(d interface{}) *Cli
- func (c *Cli) SetDefault(d interface{}) *Cli
- func (c *Cli) SetExplainItem(info string) *Cli
- func (c *Cli) SetIntDefault(d interface{}) *Cli
- func (c *Cli) SetUsage(usage string) *Cli
- type CliData
- type CliInput
- type CliRow
- type Curl
- func (h *Curl) Auth(username string, password string) *Curl
- func (h *Curl) Bind(data interface{}) error
- func (h *Curl) BindString(data interface{}) error
- func (h *Curl) ContentType(contentType string) *Curl
- func (h *Curl) Delete(data ...interface{}) *Curl
- func (h *Curl) Get(data ...interface{}) *Curl
- func (h *Curl) Head(data ...interface{}) *Curl
- func (h *Curl) Header(headerKey string, headerValue string) *Curl
- func (h *Curl) Patch(data ...interface{}) *Curl
- func (h *Curl) Post(data ...interface{}) *Curl
- func (h *Curl) Put(data ...interface{}) *Curl
- func (h *Curl) Token(token string) *Curl
- func (h *Curl) Url(uri string) *Curl
- type ExcludedExtensions
- type ExcludedPaths
- type Explain
- type GRPCContainer
- type Ginger
- func (g *Ginger) Debug(isDebug bool) *Ginger
- func (g *Ginger) GetHTTPServeMux() *http.ServeMux
- func (g *Ginger) LoadRouter(router func(router *gin.Engine) gin.IRoutes) *Ginger
- func (g *Ginger) Run(addr string, f ...func(server *grpc.Server)) (err error)
- func (g *Ginger) Start(addr string)
- func (g *Ginger) Swagger(openSwagger bool) *Ginger
- type Headers
- type JWTClaims
- type Option
- type Options
- type Orm
Constants ¶
View Source
const ( CliString = iota CliBool CliInt )
View Source
const ( ExplainMain = iota ExplainItem )
View Source
const ( BestCompression = gzip.BestCompression BestSpeed = gzip.BestSpeed DefaultCompression = gzip.DefaultCompression NoCompression = gzip.NoCompression )
View Source
const ( HS256 = 1 << iota HS384 HS512 ES256 ES384 ES512 )
签名算法列表
View Source
const EXPIRED = 3600 //过期世间
View Source
const ErrBusy = "程序忙"
错误相关常量
View Source
const ErrorReLogin = "登录过期或登录错误,请重新登录"
View Source
const SECRET = "AF9-C=AF,FJN+RVV(DDD(M1a" //混淆代码 盐
View Source
const SIGNING = HS512 //签名算法
Variables ¶
View Source
var ( DefaultExcludedExtensions = NewExcludedExtensions([]string{ ".png", ".gif", ".jpeg", ".jpg", }) DefaultOptions = &Options{ ExcludedExtensions: DefaultExcludedExtensions, } )
Functions ¶
func Cors ¶
func Cors() gin.HandlerFunc
func DefaultDecompressHandle ¶
func SignWithInfo ¶ added in v0.0.7
生成签名,并携带用户信息
func ToSignMethod ¶ added in v0.0.7
func ToSignMethod(methodInt int) (sm jwt.SigningMethod)
常量转换为固定的算法
Types ¶
type Cli ¶ added in v0.0.4
var CliIns *Cli
func (*Cli) SetBoolDefault ¶ added in v0.0.4
func (*Cli) SetDefault ¶ added in v0.0.4
func (*Cli) SetExplainItem ¶ added in v0.0.4
func (*Cli) SetIntDefault ¶ added in v0.0.4
type Curl ¶ added in v0.0.8
type Curl struct {
// contains filtered or unexported fields
}
func (*Curl) BindString ¶ added in v0.0.8
绑定参数,这里的参数必须是一个字符串的地址
func (*Curl) ContentType ¶ added in v0.0.8
ContentType 设置ContentType
type ExcludedExtensions ¶
Using map for better lookup performance
func NewExcludedExtensions ¶
func NewExcludedExtensions(extensions []string) ExcludedExtensions
func (ExcludedExtensions) Contains ¶
func (e ExcludedExtensions) Contains(target string) bool
type ExcludedPaths ¶
type ExcludedPaths []string
func NewExcludedPaths ¶
func NewExcludedPaths(paths []string) ExcludedPaths
func (ExcludedPaths) Contains ¶
func (e ExcludedPaths) Contains(requestURI string) bool
type GRPCContainer ¶ added in v0.0.6
type GRPCContainer struct {
// contains filtered or unexported fields
}
func (*GRPCContainer) New ¶ added in v0.0.6
func (g *GRPCContainer) New(addr string) *GRPCContainer
func (*GRPCContainer) Register ¶ added in v0.0.6
func (g *GRPCContainer) Register(server *interface{})
type Ginger ¶
var IGinger *Ginger
func (*Ginger) GetHTTPServeMux ¶ added in v0.0.6
func (*Ginger) LoadRouter ¶
加载路由
type JWTClaims ¶ added in v0.0.7
type JWTClaims struct { jwt.StandardClaims UserID uint `json:"user_id"` Username string `json:"username"` IsRealName int `json:"is_real_name"` Type int `json:"type"` }
定义一个结构体,用于携带额外的信息
type Option ¶
type Option func(*Options)
func WithDecompressFn ¶
func WithExcludedExtensions ¶
func WithExcludedPaths ¶
type Options ¶
type Options struct { ExcludedExtensions ExcludedExtensions ExcludedPaths ExcludedPaths DecompressFn func(c *gin.Context) }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.