agin

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJwtToken

func CreateJwtToken(uid, secret string, liveHour time.Duration) (string, error)

func ParseJwtToken

func ParseJwtToken(token string, secret string) (string, error)

Types

type Mysql

type Mysql struct {
	Path            string
	Config          string `mapstructure:"config" json:"config" yaml:"config"`
	Dbname          string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
	Username        string `mapstructure:"username" json:"username" yaml:"username"`
	Password        string `mapstructure:"password" json:"password" yaml:"password"`
	MaxIdleConns    int    `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
	MaxOpenConns    int    `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
	LogMode         bool   `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
	LogZap          string `mapstructure:"log-zap" json:"logZap" yaml:"log-zap"`
	LocalPath       string `mapstructure:"localPath" json:"localPath" yaml:"localPath"`
	CloudPath       string `mapstructure:"cloudPath" json:"cloudPath" yaml:"cloudPath"`
	DockerPath      string `mapstructure:"dockerPath" json:"dockerPath" yaml:"dockerPath"`
	InnerDockerPath string `mapstructure:"innerDockerPath" json:"innerDockerPath" yaml:"innerDockerPath"`
	LocalPwd        string `mapstructure:"localPwd" json:"localPwd" yaml:"localPwd"`
	DockerPwd       string `mapstructure:"dockerPwd" json:"dockerPwd" yaml:"dockerPwd"`
}

func (*Mysql) DSN

func (m *Mysql) DSN(mode string) string

获取dsn配置

type THttp

type THttp struct {
	Router      *gin.Engine
	T           *testing.T
	Url         string
	Method      string
	RequestBody io.Reader
	Writer      *httptest.ResponseRecorder
	Request     *http.Request
}

func NewTHttp

func NewTHttp(router *gin.Engine, t *testing.T, url string, method string, body io.Reader) THttp

func (*THttp) BaseTest

func (h *THttp) BaseTest(status int, bodyString string, message ...interface{})

type WxApp

type WxApp struct {
	AppId     string `mapstructure:"appId" json:"appId" yaml:"appId"`
	AppSecret string `mapstructure:"APPSECRET" json:"APPSECRET" yaml:"APPSECRET"`
	JwtLive   time.Duration
	JwtSecret string `mapstructure:"jwtSecret" json:"jwtSecret" yarm:"jwtSecret"`
}

func (WxApp) GetTokenInfo

func (w WxApp) GetTokenInfo(token string) (openid string, versionInfo string, err error)

func (WxApp) NewJwtToken

func (w WxApp) NewJwtToken(openid, versionInfo string) (token string, err error)

func (WxApp) WxLoginUrl

func (w WxApp) WxLoginUrl(code string) string

type WxLoginInfo

type WxLoginInfo struct {
	SessionKey string `json:"session_key"`
	Openid     string `json:"openid"`
	ErrCode    int    `json:"errcode"`
	ErrMsg     string `json:"errmsg"`
	Code       string `json:"code"`
}

func WxGetOpenidAndSessionKey

func WxGetOpenidAndSessionKey(code string, wxApp WxApp) (wxLoginInfo WxLoginInfo, err error)

客户端传来code获取openid和sessionKey

func (WxLoginInfo) NewJwtToken

func (w WxLoginInfo) NewJwtToken(versionInfo string, wxApp WxApp) (token string, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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