1 Star 0 Fork 0

gongpeng / keyauth-gp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
token_enum.pb.go 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
gongpeng 提交于 2023-03-19 15:17 . 添加user服务和token服务
// Code generated by github.com/infraboard/mcube
// DO NOT EDIT
package token
import (
"bytes"
"fmt"
"strings"
)
// ParseGranteTypeFromString Parse GranteType from string
func ParseGranteTypeFromString(str string) (GranteType, error) {
key := strings.Trim(string(str), `"`)
v, ok := GranteType_value[strings.ToUpper(key)]
if !ok {
return 0, fmt.Errorf("unknown GranteType: %s", str)
}
return GranteType(v), nil
}
// Equal type compare
func (t GranteType) Equal(target GranteType) bool {
return t == target
}
// IsIn todo
func (t GranteType) IsIn(targets ...GranteType) bool {
for _, target := range targets {
if t.Equal(target) {
return true
}
}
return false
}
// MarshalJSON todo
func (t GranteType) MarshalJSON() ([]byte, error) {
b := bytes.NewBufferString(`"`)
b.WriteString(strings.ToUpper(t.String()))
b.WriteString(`"`)
return b.Bytes(), nil
}
// UnmarshalJSON todo
func (t *GranteType) UnmarshalJSON(b []byte) error {
ins, err := ParseGranteTypeFromString(string(b))
if err != nil {
return err
}
*t = ins
return nil
}
Go
1
https://gitee.com/gongpengABC/keyauth-gp.git
git@gitee.com:gongpengABC/keyauth-gp.git
gongpengABC
keyauth-gp
keyauth-gp
v0.0.9

搜索帮助

53164aa7 5694891 3bd8fe86 5694891