Skip to content

Commit

Permalink
no need to use gen.IncrementStarts
Browse files Browse the repository at this point in the history
  • Loading branch information
masseelch committed Jan 16, 2025
1 parent 69d4646 commit 2d5b1ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions entgql/internal/todoglobalid/ent/gql_node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions entgql/template/node.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ type nodeOptions struct {
// Each node has a range of 1<<32 ids. Pre-computing a map of node starting
// value to node type ensures node type resolution happens in O(1) complexity.
var nodeTypes = func () map[int]string {
var is gen.IncrementStarts
var is map[string]int
if err := json.Unmarshal([]byte(internal.IncrementStarts), &is); err != nil {
panic(err)
}
// Get a map of range starting value to node type.
m := make(map[int]string, len(is))
for k, v := range is {
m[int(v)] = k // ent ensures there are no duplicate starting values
m[v] = k // ent ensures there are no duplicate starting values
}
return m
}()
Expand Down

0 comments on commit 2d5b1ff

Please sign in to comment.