1 Star 2 Fork 2

小桀/fate

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
session_enum.go 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
godcong 提交于 2023-03-15 15:30 . feat(fate): change for v4
// Code generated by go-enum DO NOT EDIT.
// Version:
// Revision:
// Build Date:
// Built By:
package fate
import (
"errors"
"fmt"
)
const (
// SessionStateWaiting is a SessionState of type Waiting.
SessionStateWaiting SessionState = iota
// SessionStateGenerating is a SessionState of type Generating.
SessionStateGenerating
// SessionStateFinish is a SessionState of type Finish.
SessionStateFinish
// SessionStateCanceled is a SessionState of type Canceled.
SessionStateCanceled
// SessionStateFailed is a SessionState of type Failed.
SessionStateFailed
)
var ErrInvalidSessionState = errors.New("not a valid SessionState")
const _SessionStateName = "waitinggeneratingfinishcanceledfailed"
var _SessionStateMap = map[SessionState]string{
SessionStateWaiting: _SessionStateName[0:7],
SessionStateGenerating: _SessionStateName[7:17],
SessionStateFinish: _SessionStateName[17:23],
SessionStateCanceled: _SessionStateName[23:31],
SessionStateFailed: _SessionStateName[31:37],
}
// String implements the Stringer interface.
func (x SessionState) String() string {
if str, ok := _SessionStateMap[x]; ok {
return str
}
return fmt.Sprintf("SessionState(%d)", x)
}
var _SessionStateValue = map[string]SessionState{
_SessionStateName[0:7]: SessionStateWaiting,
_SessionStateName[7:17]: SessionStateGenerating,
_SessionStateName[17:23]: SessionStateFinish,
_SessionStateName[23:31]: SessionStateCanceled,
_SessionStateName[31:37]: SessionStateFailed,
}
// ParseSessionState attempts to convert a string to a SessionState.
func ParseSessionState(name string) (SessionState, error) {
if x, ok := _SessionStateValue[name]; ok {
return x, nil
}
return SessionState(0), fmt.Errorf("%s is %w", name, ErrInvalidSessionState)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/tangri/fate.git
git@gitee.com:tangri/fate.git
tangri
fate
fate
main

搜索帮助