-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dustin/upgrade-goccy-json-lib
- Loading branch information
Showing
14 changed files
with
2,614 additions
and
132 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ const ( | |
NodeKindCustom | ||
NodeKindScalar | ||
NodeKindStaticString | ||
NodeKindEnum | ||
) | ||
|
||
type Node interface { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package resolve | ||
|
||
import "slices" | ||
|
||
type Enum struct { | ||
Path []string | ||
Nullable bool | ||
Export *FieldExport `json:"export,omitempty"` | ||
TypeName string | ||
Values []string | ||
InaccessibleValues []string | ||
} | ||
|
||
func (_ *Enum) NodeKind() NodeKind { | ||
return NodeKindEnum | ||
} | ||
|
||
func (e *Enum) Copy() Node { | ||
return &Enum{ | ||
Path: e.Path, | ||
Nullable: e.Nullable, | ||
Export: e.Export, | ||
} | ||
} | ||
|
||
func (e *Enum) NodePath() []string { | ||
return e.Path | ||
} | ||
|
||
func (e *Enum) NodeNullable() bool { | ||
return e.Nullable | ||
} | ||
|
||
func (e *Enum) Equals(n Node) bool { | ||
other, ok := n.(*Enum) | ||
if !ok { | ||
return false | ||
} | ||
|
||
if e.Nullable != other.Nullable { | ||
return false | ||
} | ||
|
||
if !slices.Equal(e.Path, other.Path) { | ||
return false | ||
} | ||
|
||
return true | ||
} | ||
|
||
func (e *Enum) isValidValue(returnedValue string) bool { | ||
return slices.Contains(e.Values, returnedValue) | ||
} | ||
|
||
func (e *Enum) isAccessibleValue(returnedValue string) bool { | ||
return !slices.Contains(e.InaccessibleValues, returnedValue) | ||
} |
Oops, something went wrong.