Documentation
¶
Index ¶
- func GenerateJWT(data interface{}, secret string, extras ...map[string]interface{}) (string, error)
- func ParseJWT(tokenString string, secret string) (map[string]interface{}, error)
- type LoginReq
- type Serv
- func (s *Serv) GetApiName() string
- func (s *Serv) GetToken(ctx context.Context, jwtStr string) (kratos.Token, error)
- func (s *Serv) GetUserInfo(ctx context.Context, token kratos.Token, buffer []byte, ...) (interface{}, error)
- func (s *Serv) Login(ctx context.Context, token kratos.Token, buffer []byte, ...) (interface{}, error)
- func (s *Serv) MongoClient() *mongo.Client
- func (s *Serv) QueryTime(start, end string) (bson.M, error)
- func (s *Serv) QueryValue(data bson.M, query map[string]string, key string) bson.M
- func (s *Serv) SessionName() string
- func (s *Serv) Start(addr string, router *httprouter.Router) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateJWT ¶
GenerateJWT 生成通用 JWT。 data: 任意结构体或 map,将被放入 payload。 secret: 签名密钥。 extras(可选): 附加的 claims map[string]interface{},用于添加或覆盖字段。
Types ¶
type Serv ¶
type Serv struct {
Db *mongo.Database
Cfg *goconfig.ConfigFile
// contains filtered or unexported fields
}
func (*Serv) GetApiName ¶
func (*Serv) GetUserInfo ¶
func (*Serv) MongoClient ¶
func (*Serv) QueryValue ¶
func (*Serv) SessionName ¶
Click to show internal directories.
Click to hide internal directories.