Documentation ¶
Index ¶
- Constants
- func Contains(slice []string, item string) bool
- func DeleteAccountIndex(id string)
- func DeleteBlogIndex(id string)
- func DeleteProjectIndex(id string)
- func GenerateJwtCode(info dto.LoginUserInfo) string
- func GenerateJwtToken(info string, expireAt time.Time) string
- func GenerateVerifyJwtToken(info string) string
- func GetKey() (key []byte, err error)
- func GetUserInfo(ctx *gin.Context) (uinfo dto.LoginUserInfo, ext bool)
- func IndexAccount(account *model.Account)
- func IndexAccounts(accounts []model.Account)
- func IndexBlog(blog *model.Blog)
- func IndexBlogs(blog []model.Blog)
- func IndexProject(project *model.Project)
- func IsEnvRelease() (release bool)
- func IsInRole(ctx *gin.Context, role model.Erole) (result bool)
- func ParseJwt(tokenString string) (userInfo dto.LoginUserInfo, err error)
- func ParsePagination(ctx *gin.Context) (page int64, pagesize int64, err error)
- func ProcessAllFiles(srcPath string, uploadRootPath string, ...)
- func QueryAccountPrefix(term string) search.DocumentMatchCollection
- func QueryBlog(search string, page int, pagesize int) search.DocumentMatchCollection
- func QueryBlogPrefix(term string) search.DocumentMatchCollection
- func QueryProject(search string, page int, pagesize int) search.DocumentMatchCollection
- func QueryUser(search string, page int, pagesize int) search.DocumentMatchCollection
- func UploadCDN()
- type JwtInfoClaims
- type JwtLoginClaims
Examples ¶
Constants ¶
const UserInfoKey = "User"
UserInfoKey name of param whitch stores userinfo in gin.Context
Variables ¶
This section is empty.
Functions ¶
func DeleteAccountIndex ¶
func DeleteAccountIndex(id string)
func DeleteBlogIndex ¶
func DeleteBlogIndex(id string)
func DeleteProjectIndex ¶
func DeleteProjectIndex(id string)
func GenerateJwtCode ¶
func GenerateJwtCode(info dto.LoginUserInfo) string
GenerateJwtCode generate jwt token with claim in type JwtClaims for info dto.LoginUserInfo jwtToken string
func GenerateJwtToken ¶
GenerateJwtToken generate jwt token with claim in type JwtClaims for info string jwtToken string
func GenerateVerifyJwtToken ¶
GenerateVerifyJwtToken generate jwt token with claim in type JwtClaims for info string jwtToken string
func GetUserInfo ¶
func GetUserInfo(ctx *gin.Context) (uinfo dto.LoginUserInfo, ext bool)
GetUserInfo get user info from gin context
func IndexAccount ¶
func IndexAccounts ¶
func IndexProject ¶
func ParseJwt ¶
func ParseJwt(tokenString string) (userInfo dto.LoginUserInfo, err error)
ParseJwt for JwtLoginClaims if token is valid, return nil
func ParsePagination ¶
ParsePagination get pagination info from ctx
func ProcessAllFiles ¶
func ProcessAllFiles(srcPath string, uploadRootPath string, processHandler func(parameter ...string))
ProcessAllFiles use handler function to process each file recursively under srcPath
Example ¶
ProcessAllFiles("./", "/dist", func(parameter ...string) { println(parameter[0], "\n", parameter[2]) //for _,v :=range parameter{ // println(v) //} })
Output:
func QueryAccountPrefix ¶
func QueryAccountPrefix(term string) search.DocumentMatchCollection
func QueryBlog ¶
func QueryBlog(search string, page int, pagesize int) search.DocumentMatchCollection
func QueryBlogPrefix ¶
func QueryBlogPrefix(term string) search.DocumentMatchCollection
func QueryProject ¶
func QueryProject(search string, page int, pagesize int) search.DocumentMatchCollection
Types ¶
type JwtInfoClaims ¶
type JwtInfoClaims struct { Info string `json:"info"` jwt.StandardClaims }
JwtInfoClaims claim with extra string info
type JwtLoginClaims ¶
type JwtLoginClaims struct { UserInfo dto.LoginUserInfo `json:"user_info"` jwt.StandardClaims }
JwtLoginClaims mo2 jwt claims