Ai
1 Star 0 Fork 0

player1/restful-api-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
visiable_enum.pb.go 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
player1 提交于 2024-03-01 00:52 +08:00 . book-grpc集成至原先demo中
// Code generated by github.com/infraboard/mcube
// DO NOT EDIT
package resource
import (
"bytes"
"fmt"
"strings"
)
// ParseVISIABLEFromString Parse VISIABLE from string
func ParseVISIABLEFromString(str string) (VISIABLE, error) {
key := strings.Trim(string(str), `"`)
v, ok := VISIABLE_value[strings.ToUpper(key)]
if !ok {
return 0, fmt.Errorf("unknown VISIABLE: %s", str)
}
return VISIABLE(v), nil
}
// Equal type compare
func (t VISIABLE) Equal(target VISIABLE) bool {
return t == target
}
// IsIn todo
func (t VISIABLE) IsIn(targets ...VISIABLE) bool {
for _, target := range targets {
if t.Equal(target) {
return true
}
}
return false
}
// MarshalJSON todo
func (t VISIABLE) MarshalJSON() ([]byte, error) {
b := bytes.NewBufferString(`"`)
b.WriteString(strings.ToUpper(t.String()))
b.WriteString(`"`)
return b.Bytes(), nil
}
// UnmarshalJSON todo
func (t *VISIABLE) UnmarshalJSON(b []byte) error {
ins, err := ParseVISIABLEFromString(string(b))
if err != nil {
return err
}
*t = ins
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/player1111/restful-api-demo.git
git@gitee.com:player1111/restful-api-demo.git
player1111
restful-api-demo
restful-api-demo
19fd67857982

搜索帮助