v0.0.0-...-1f4ee57 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 24 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type AuthInfo

type AuthInfo interface {
	IdStr() string

type Authorization

type Authorization struct {
	AuthInfo     `json:"auth"`
	IdStr        string `json:"-" gorm:"-"`
	LastActiveAt int64  `json:"lat,omitempty"`
	ExpiredAt    int64  `json:"exp,omitempty"`
	LoginAt      int64  `json:"iat,omitempty"`
	Token        string `json:"-"`

func (*Authorization) GenerateToken

func (x *Authorization) GenerateToken(secret []byte) (string, error)

func (*Authorization) ParseToken

func (x *Authorization) ParseToken(token, secret string) error

func (*Authorization) Valid

func (x *Authorization) Valid(helper *jwt.ValidationHelper) error

type Ctx

func CtxFromContext

func CtxFromContext(ctx context.Context) *Ctx

func CtxFromFastRequest

func CtxFromFastRequest(r *fasthttp.Request) *Ctx

func CtxFromRequest

func CtxFromRequest(r *http.Request) *Ctx

func CtxWithFastRequest

func CtxWithFastRequest(ctx context.Context, r *fasthttp.Request) *Ctx

func CtxWithRequest

func CtxWithRequest(ctx context.Context, r *http.Request) *Ctx

func (*Ctx) ContextWrapper

func (ctxi *Ctx) ContextWrapper() context.Context

func (*Ctx) Error

func (c *Ctx) Error(args ...interface{})

func (*Ctx) ErrorLog

func (c *Ctx) ErrorLog(err, originErr error, funcName string) error

func (*Ctx) GetAuthInfo

func (c *Ctx) GetAuthInfo(auth func(*Ctx) error) (AuthInfo, error)

func (*Ctx) HandleError

func (c *Ctx) HandleError(err error)

func (*Ctx) Method

func (c *Ctx) Method() string

func (*Ctx) NewDB

func (c *Ctx) NewDB(db *gorm.DB) *gorm.DB

func (*Ctx) SendHeader

func (c *Ctx) SendHeader(md metadata.MD) error

func (*Ctx) SetCookie

func (c *Ctx) SetCookie(v string) error

func (*Ctx) SetHeader

func (c *Ctx) SetHeader(md metadata.MD) error

func (*Ctx) SetTrailer

func (c *Ctx) SetTrailer(md metadata.MD) error

func (*Ctx) StartSpan

func (c *Ctx) StartSpan(name string, o ...trace.StartOption) (*Ctx, *trace.Span)

func (*Ctx) WithContext

func (c *Ctx) WithContext(ctx context.Context)

func (*Ctx) WriteHeader

func (c *Ctx) WriteHeader(k, v string) error

type DeviceInfo

type DeviceInfo struct {
	Device     string `json:"device" gorm:"size:255"`
	Os         string `json:"os" gorm:"size:255"`
	AppCode    string `json:"appCode" gorm:"size:255"`
	AppVersion string `json:"appVersion" gorm:"size:255"`
	IP         string `json:"ip" gorm:"size:255"`
	Lng        string `json:"lng" gorm:"type:numeric(10,6)"`
	Lat        string `json:"lat" gorm:"type:numeric(10,6)"`
	Area       string `json:"area" gorm:"size:255"`
	UserAgent  string `json:"userAgent" gorm:"size:255"`

func Device

func Device(r http.Header) *DeviceInfo

func DeviceFast

func DeviceFast(r *fasthttp.RequestHeader) *DeviceInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL