Skip to content

Commit

Permalink
Merge pull request #484 from redis/fix-graph-constraint-builders
Browse files Browse the repository at this point in the history
feat: GRAPH.CONSTRAINT CREATE builder
  • Loading branch information
rueian committed Feb 29, 2024
2 parents 16d5f13 + 544ec4b commit ded6852
Show file tree
Hide file tree
Showing 4 changed files with 260 additions and 7 deletions.
100 changes: 98 additions & 2 deletions hack/cmds/commands_graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,107 @@
"GRAPH.CONSTRAINT DROP": {
"summary": "Deletes a constraint from specified graph",
"since": "2.12.0",
"group": "graph"
"group": "graph",
"arguments": [
{
"name": "key",
"type": "key"
},
{
"name": "mode",
"type": "oneof",
"arguments": [
{
"name": "MANDATORY",
"type": "pure-token",
"token": "MANDATORY"
},
{
"name": "UNIQUE",
"type": "pure-token",
"token": "UNIQUE"
}
]
},
{
"name": "entity",
"type": "oneof",
"arguments": [
{
"name": "NODE",
"type": "string",
"command": "NODE"
},
{
"name": "RELATIONSHIP",
"type": "string",
"command": "RELATIONSHIP"
}
]
},
{
"name": "PROPERTIES",
"command": "PROPERTIES",
"type": "integer"
},
{
"name": "PROP",
"type": "string",
"multiple": true
}
]
},
"GRAPH.CONSTRAINT CREATE": {
"summary": "Creates a constraint on specified graph",
"since": "2.12.0",
"group": "graph"
"group": "graph",
"arguments": [
{
"name": "key",
"type": "key"
},
{
"name": "mode",
"type": "oneof",
"arguments": [
{
"name": "MANDATORY",
"type": "pure-token",
"token": "MANDATORY"
},
{
"name": "UNIQUE",
"type": "pure-token",
"token": "UNIQUE"
}
]
},
{
"name": "entity",
"type": "oneof",
"arguments": [
{
"name": "NODE",
"type": "string",
"command": "NODE"
},
{
"name": "RELATIONSHIP",
"type": "string",
"command": "RELATIONSHIP"
}
]
},
{
"name": "PROPERTIES",
"command": "PROPERTIES",
"type": "integer"
},
{
"name": "PROP",
"type": "string",
"multiple": true
}
]
}
}
5 changes: 4 additions & 1 deletion hack/cmds/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"os/exec"
"path/filepath"
"reflect"
"sort"
"strings"
"unicode"
Expand Down Expand Up @@ -413,7 +414,9 @@ func main() {
n.Walk(func(n *node) {
for _, s := range n.GoStructs() {
if v, ok := structs[g][s.FullName]; ok {
panic("struct conflict " + v.FullName)
if !reflect.DeepEqual(v, s) {
panic("struct conflict " + v.FullName)
}
}
structs[g][s.FullName] = s
}
Expand Down
152 changes: 150 additions & 2 deletions internal/cmds/gen_graph.go

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

10 changes: 8 additions & 2 deletions internal/cmds/gen_graph_test.go

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

0 comments on commit ded6852

Please sign in to comment.