mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
schema/field: add option to set the Go identifier for enums (#635)
This commit is contained in:
@@ -101,7 +101,7 @@ func (s State) String() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// StateValidator is a validator for the "s" field enum values. It is called by the builders before save.
|
||||
// StateValidator is a validator for the "state" field enum values. It is called by the builders before save.
|
||||
func StateValidator(s State) error {
|
||||
switch s {
|
||||
case StateLoggedIn, StateLoggedOut:
|
||||
|
||||
@@ -105,7 +105,7 @@ func (s State) String() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// StateValidator is a validator for the "s" field enum values. It is called by the builders before save.
|
||||
// StateValidator is a validator for the "state" field enum values. It is called by the builders before save.
|
||||
func StateValidator(s State) error {
|
||||
switch s {
|
||||
case StateLoggedIn, StateLoggedOut, StateOnline:
|
||||
@@ -128,7 +128,7 @@ func (s Status) String() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// StatusValidator is a validator for the "s" field enum values. It is called by the builders before save.
|
||||
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
|
||||
func StatusValidator(s Status) error {
|
||||
switch s {
|
||||
case StatusDone, StatusPending:
|
||||
|
||||
Reference in New Issue
Block a user