diff --git a/dialect/gremlin/graph/dsl/__/dsl.go b/dialect/gremlin/graph/dsl/__/dsl.go index 4e9dfa93a..7c4aeb549 100644 --- a/dialect/gremlin/graph/dsl/__/dsl.go +++ b/dialect/gremlin/graph/dsl/__/dsl.go @@ -14,6 +14,9 @@ func Not(args ...interface{}) *dsl.Traversal { return New().Not(args...) } // Has is the api for calling __.Has(). func Has(args ...interface{}) *dsl.Traversal { return New().Has(args...) } +// HasNot is the api for calling __.HasNot(). +func HasNot(args ...interface{}) *dsl.Traversal { return New().HasNot(args...) } + // Or is the api for calling __.Or(). func Or(args ...interface{}) *dsl.Traversal { return New().Or(args...) } diff --git a/dialect/gremlin/graph/dsl/dsl_test.go b/dialect/gremlin/graph/dsl/dsl_test.go index a50f9745a..cf499c1b0 100644 --- a/dialect/gremlin/graph/dsl/dsl_test.go +++ b/dialect/gremlin/graph/dsl/dsl_test.go @@ -130,6 +130,11 @@ func TestTraverse(t *testing.T) { wantQuery: "g.V().count()", wantBinds: dsl.Bindings{}, }, + { + input: g.V().HasNot("age"), + wantQuery: "g.V().hasNot($0)", + wantBinds: dsl.Bindings{"$0": "age"}, + }, { input: func() *dsl.Traversal { v := g.V().HasID(1) diff --git a/dialect/gremlin/graph/dsl/traversal.go b/dialect/gremlin/graph/dsl/traversal.go index ccf1c2bf2..f25b92bdf 100644 --- a/dialect/gremlin/graph/dsl/traversal.go +++ b/dialect/gremlin/graph/dsl/traversal.go @@ -112,6 +112,12 @@ func (t *Traversal) Has(args ...interface{}) *Traversal { return t.Add(Dot, NewFunc("has", args...)) } +// HasNot filters vertices, edges and vertex properties based on the non-existence of properties. +// See: http://tinkerpop.apache.org/docs/current/reference/#has-step. +func (t *Traversal) HasNot(args ...interface{}) *Traversal { + return t.Add(Dot, NewFunc("hasNot", args...)) +} + // HasID filters vertices, edges and vertex properties based on their identifier. func (t *Traversal) HasID(args ...interface{}) *Traversal { return t.Add(Dot, NewFunc("hasId", args...)) diff --git a/dialect/sql/builder_test.go b/dialect/sql/builder_test.go index 901210e7a..31af16e77 100644 --- a/dialect/sql/builder_test.go +++ b/dialect/sql/builder_test.go @@ -191,6 +191,17 @@ func TestBuilder(t *testing.T) { Where(NotNull("parent_id")), wantQuery: "DELETE FROM `users` WHERE `parent_id` IS NOT NULL", }, + { + input: Delete("users"). + Where(IsNull("parent_id")), + wantQuery: "DELETE FROM `users` WHERE `parent_id` IS NULL", + }, + { + input: Delete("users"). + Where(IsNull("parent_id").And().NotIn("name", "foo", "bar")), + wantQuery: "DELETE FROM `users` WHERE `parent_id` IS NULL AND `name` NOT IN (?, ?)", + wantArgs: []interface{}{"foo", "bar"}, + }, { input: Delete("users"). Where(False().And().False()), diff --git a/entc/gen/bindata.go b/entc/gen/bindata.go index bb9c0a174..ebfde5e6b 100644 --- a/entc/gen/bindata.go +++ b/entc/gen/bindata.go @@ -424,7 +424,7 @@ func templateDialectGremlinMetaTmpl() (*asset, error) { return a, nil } -var _templateDialectGremlinPredicateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x56\x4d\x6f\xdb\x38\x10\x3d\xcb\xbf\x62\x60\x04\x58\xc9\x50\xa8\x3d\x2f\xe0\x43\x76\x37\xbb\x35\x50\xc4\x68\x53\xa4\x87\x20\x30\x18\x71\x64\x13\x51\x48\x81\xa4\x94\x83\xc0\xff\x5e\x8c\x28\x5b\xfe\x4a\x63\xc4\x68\x8b\x9e\x2c\x78\x1e\x67\xde\xbc\x79\x03\xb2\x6d\x41\x60\x21\x15\xc2\x58\x48\x5e\x62\xee\xb2\xa5\xc1\xe7\x52\xaa\xac\x32\x28\x64\xce\x1d\x66\x52\x8c\xe1\xd2\xfb\x51\x54\xd4\x2a\x8f\x1d\x4c\x84\x2d\xd9\x17\xc3\x1b\x34\x96\x97\x09\xb4\xa3\x28\x72\xec\x03\xb7\xb3\x7f\x63\x29\x92\x51\xe4\x47\x6d\x7b\x09\xa8\x04\x78\x3f\x1a\x9d\x58\x23\xd3\x95\x0d\x75\xe8\xf0\x85\xae\xe0\xaf\x29\x5c\xb0\xdb\x5c\x57\xc8\xe6\xd5\x10\xe1\x66\xb9\x1d\xba\x32\xcb\x37\xd9\xd1\x39\x59\x50\x52\x76\xc7\x8d\xe4\x42\xe6\x44\x2d\x8a\xa2\x86\x52\x3d\xf3\x27\x8c\xef\x1f\xa4\x72\x68\x0a\x9e\x63\xeb\x53\x28\x51\xc5\x6d\x1b\xaa\x79\x9f\x24\x04\x2e\xb4\x01\x49\x07\x0c\x57\x4b\x84\xa6\xcb\x1d\x45\xcd\xbd\x7c\x80\x29\x0c\xe8\x7b\xf9\x40\x01\xdf\x57\xee\x85\x18\x44\xaa\x18\x61\x75\xc5\xfe\x0f\x3a\x80\xf7\x54\xeb\x90\x61\xc3\x18\x41\xb1\xb4\x08\xde\x0f\x05\xe8\xbf\x2e\x69\xf2\x3e\xb5\x0b\x89\xe5\x7a\xa8\x9d\xa6\xc5\xb6\xa2\xff\x51\xf4\xb4\x89\xc7\x1f\xf9\x23\x96\x69\xd7\x7b\xc1\xfe\xd1\xca\x3a\xae\x1c\x78\x9f\x42\xc5\xae\x3f\xc5\xcd\x39\x04\x07\x47\x7c\x9f\xe4\xeb\x7e\x39\x8f\xff\xe1\x90\x9a\xa3\x53\xea\x87\x74\xce\x40\x50\x2c\x31\x5b\xf1\x9d\x76\x71\xbb\xa1\x6b\xb1\xc4\xad\x58\x49\xb4\xbb\x38\x0e\xac\x87\xb0\x90\x06\x73\x27\xb5\x22\xc8\x78\x5e\xbb\xad\xbc\xc4\x1f\xd9\xcc\xce\x14\xa9\xd1\x27\xdd\x3f\x36\x85\xf1\x4c\x8d\x37\xb1\x6c\x02\xbc\xd1\x52\x40\x2e\x4d\x5e\x97\xdc\x80\xc0\x0a\x95\xc0\x5c\xa2\x85\x49\x36\xa4\x08\xc4\x3a\x5e\x7d\x81\x43\x7a\xa4\xcc\x29\x1b\x9b\x4d\x88\xac\x74\x7f\x58\xe0\x0a\x48\x22\x78\x91\x6e\x05\x16\xcb\xe2\xd2\x60\x81\x06\x55\x8e\x29\x38\xfe\x84\xe0\x56\x08\xee\x45\x43\x83\xc6\xc9\x7c\x97\x55\x68\xf9\x16\xcb\xe2\x33\x16\xfd\xe2\x3b\xf6\xb7\x76\xab\x6e\xc5\x03\x67\xef\x93\xf5\xbe\x86\x75\x0b\x28\x02\x0c\xba\x78\x7f\xbd\x7b\xe4\x20\x7e\x17\x27\x7b\x6b\x7f\x86\x1d\xa8\xdd\x9f\x60\x89\x0b\x19\x46\xb5\xd8\x05\x6d\x1c\xf0\x5e\xdb\x1c\xcd\xbc\x53\xfd\x97\x79\x6b\xdf\x12\x1d\x0f\x32\x96\xc1\x02\x9e\x91\x2b\x0b\xd2\x81\x5d\xe9\xba\x14\xf0\x88\xe0\x4c\x8d\x20\x15\x68\x85\xa0\x8b\xce\x6d\x9b\x96\x36\x2c\x23\xa9\x52\xd0\xb5\x23\xf5\x16\x0b\x36\x53\x77\x71\x92\xd2\xd7\xbc\x76\xc1\x17\xdd\x15\xb2\x48\xa1\x1a\x6e\x11\x9a\xba\xed\x6f\x92\x2a\x96\x2a\xe9\xbf\x74\xed\x92\xf5\x2d\x12\x39\xf6\x75\x85\x06\xe3\x2e\x46\x09\x4d\xf8\x8c\x42\xf2\x7d\x53\x06\xb0\x54\x49\xba\x41\xcd\xd4\x71\x10\x95\x09\xa8\xf0\x73\x6c\x09\x4c\xdf\x10\x9d\x3f\x1c\xe8\xda\xf3\x6f\xf6\xe6\xcc\x76\x43\x6f\x2d\x56\xa0\xe7\xcc\x0f\x5a\x31\xae\x76\x5f\x35\xe6\xf8\x25\x61\xec\x6b\x0f\x84\x3f\xc3\x1b\x61\x93\xd1\x76\x6f\x84\xe3\x1a\x04\x40\x10\x62\xed\x8e\x1b\x7c\x09\xb2\x55\x71\x18\x34\xd5\x9a\x02\xaf\xc8\xfc\xb1\x33\x36\x85\xee\xff\xee\xe1\x60\x7a\x39\x16\x0b\x76\x15\xa2\x8c\xb1\x77\xde\x35\xda\xfc\x9e\x8d\xcf\xcd\x79\x7d\x2b\xed\x4e\x69\x7c\x8f\x65\x4f\x72\x9b\xc8\x8d\x76\xb1\xdb\x27\xf1\x2d\x00\x00\xff\xff\x8f\xe5\x3c\xa1\x4a\x0b\x00\x00") +var _templateDialectGremlinPredicateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x56\x5d\x8b\xeb\x36\x10\x7d\x76\x7e\xc5\x10\x16\x6a\x07\xaf\xdc\xe7\x42\x1e\x6e\xdb\x6d\x1b\x28\x1b\xda\x5b\xb6\x0f\xcb\x12\x74\xed\x71\x22\xae\x57\x32\xd2\xd8\xfb\x60\xf4\xdf\x8b\x24\xc7\x76\x3e\x6e\x13\xb2\xfd\xe0\x3e\xc5\x78\x46\x33\x67\xce\x39\xce\xa8\xeb\xa0\xc0\x52\x48\x84\x79\x21\x78\x85\x39\x65\x5b\x8d\xaf\x95\x90\x59\xad\xb1\x10\x39\x27\xcc\x44\x31\x87\x7b\x6b\x67\x51\xd9\xc8\x3c\x26\x58\x14\xa6\x62\x7f\x68\xde\xa2\x36\xbc\x4a\xa0\x9b\x45\x11\xb1\x5f\xb8\x59\xfd\x18\x8b\x22\x99\x45\x76\xd6\x75\xf7\x80\xb2\x00\x6b\x67\xb3\x2b\x7b\x64\xaa\x36\xa1\x8f\x3b\x7c\xa7\x6a\xf8\x6e\x09\x77\xec\x63\xae\x6a\x64\xeb\x7a\x8c\x70\xbd\x9d\x86\x3e\xe8\xed\x45\x74\xee\x9c\x28\x5d\x51\xf6\xc4\xb5\xe0\x85\xc8\x1d\xb4\x28\x8a\x5a\x57\xea\x95\x7f\xc6\xf8\xf9\x45\x48\x42\x5d\xf2\x1c\x3b\x9b\x42\x85\x32\xee\xba\xd0\xcd\xda\x24\x71\xc9\xa5\xd2\x20\xdc\x01\xcd\xe5\x16\xa1\xf5\xb5\xa3\xa8\x7d\x16\x2f\xb0\x84\x31\xfb\x59\xbc\xb8\x80\xed\x3b\xf7\x44\x8c\x24\xd5\xcc\xe5\xaa\x9a\xfd\x1c\x78\x00\x6b\x5d\xaf\x53\x84\x2d\x63\x2e\x15\x2b\x83\x60\xed\xd8\xc0\xbd\xf3\x45\x93\xdb\xd8\x2e\x05\x56\x7b\x51\x3d\xa7\xe5\x94\xd1\x9f\x5c\xf4\x3a\xc5\xe3\x5f\xf9\x27\xac\x52\x3f\x7b\xc9\x7e\x50\xd2\x10\x97\x04\xd6\xa6\x50\xb3\x87\xdf\xe2\xf6\x3d\x00\x47\x47\xfc\x3d\xc8\x2f\xfb\xe5\x0a\x4f\x48\x45\x9e\xf5\x47\x51\x8d\xb6\xb8\x3c\xdb\xa9\x80\xed\x59\x05\x7b\x01\x07\xb1\x82\x21\x82\x9e\xfb\x46\xbe\x4f\xe8\x96\x9c\x77\xc6\x61\xff\xe4\xc8\x57\x37\xf0\x8b\xc5\x16\xb3\x1d\x3f\xa0\x17\xa7\x04\x3e\x14\x5b\x9c\xc4\x2a\x07\xce\xc7\x71\x44\x32\x86\x0b\xa1\x31\x27\xa1\xa4\x4b\x99\xaf\x1b\x9a\xd4\x75\x9c\x20\x5b\x99\x95\x74\xec\xf7\x45\x8f\x8f\x2d\x61\xbe\x92\xf3\x21\x96\x2d\x80\xb7\x4a\x14\x90\x0b\x9d\x37\x15\xd7\x50\x60\x8d\xb2\xc0\x5c\xa0\x81\x45\x36\x96\x08\xc0\x3c\xae\xbe\xc1\x29\x3c\xc7\xcc\x35\x6e\xc8\x16\x0e\xac\xa0\x6f\x0c\x70\x09\x8e\x22\x78\x13\xb4\x03\x83\x55\x79\xaf\xb1\x44\x8d\x32\xc7\x14\x88\x7f\x46\xa0\x1d\x02\xbd\x29\x68\x51\x93\xc8\x0f\x51\x85\x91\x3f\x62\x55\xfe\x8e\x65\xff\x47\x43\xec\x7b\x45\x3b\x2f\x66\xc0\x3c\xd1\x71\xb0\x43\x44\x5e\xff\x91\x17\x6b\x1f\x0e\x8f\x9c\xc4\x9f\xe2\x7f\xd0\x0e\x6e\xdc\xff\xc0\x12\x77\x22\x48\xb5\x39\x4c\x1a\x1c\x70\xab\x6d\xce\x56\x3e\xe8\xfe\xbf\x79\xeb\xd8\x12\x1e\x87\x33\x96\xc6\x12\x5e\x91\x4b\x03\x82\xc0\xec\x54\x53\x15\xf0\x09\x81\x74\x83\x20\x24\x28\x89\xa0\x4a\xef\xb6\x61\xa4\x01\x65\x24\x64\x0a\xaa\x21\xc7\xde\x66\xc3\x56\xf2\x29\x4e\x52\xf7\xb4\x6e\x28\xf8\xc2\xaf\xac\x4d\x0a\xf5\xb8\xb5\x9c\xea\xa6\xdf\x5c\x75\x2c\x64\xd2\x3f\xa9\x86\x92\xfd\xd6\x8a\x88\xfd\xb9\x43\x8d\xb1\x8f\xb9\x82\x3a\x3c\x46\xa1\xf8\xb1\x29\x43\xb2\x90\x49\x3a\x64\xad\xe4\xf9\x24\xd7\x26\x64\x85\x9f\x73\x1f\x81\xee\x07\x72\xe7\x4f\x05\xdd\x7b\xfe\xe2\x6c\xa4\xa7\x03\x5d\xfa\xb0\x02\x3c\xd2\xff\xd2\x27\xc6\xe5\xe1\x2d\x4a\x9f\x5f\xaa\xda\x7c\xe9\x42\xf2\x6d\xb8\x93\x0c\x15\x8d\x5f\x27\xe7\x39\x08\x09\x81\x88\xbd\x3b\x1e\xf1\x2d\xd0\x56\xc7\x41\x68\xd7\x6b\x09\xbc\x76\xe6\x8f\x49\x9b\x14\xfc\x7b\xbf\x96\x74\x4f\xc7\x66\xc3\x3e\x84\x28\x63\xec\xc6\x5d\xae\xf4\xd7\x39\xf8\x5a\xbf\x6f\x6e\xa9\xe8\x9a\xc1\x8f\x50\xf6\x20\xa7\x40\x1e\x15\xc5\x74\x0c\xe2\xaf\x00\x00\x00\xff\xff\x9d\x7b\x7e\x88\xba\x0b\x00\x00") func templateDialectGremlinPredicateTmplBytes() ([]byte, error) { return bindataRead( @@ -439,7 +439,7 @@ func templateDialectGremlinPredicateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/predicate.tmpl", size: 2890, mode: os.FileMode(420), modTime: time.Unix(1565164297, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/predicate.tmpl", size: 3002, mode: os.FileMode(420), modTime: time.Unix(1565168181, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -624,7 +624,7 @@ func templateDialectSqlMetaTmpl() (*asset, error) { return a, nil } -var _templateDialectSqlPredicateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x57\xdf\x4f\xeb\x36\x14\x7e\x0e\x7f\xc5\x11\xaa\x34\x07\x15\x17\x0a\xbc\x4c\x62\x12\x62\x20\x75\x1b\x74\x13\x57\xdb\x03\x42\x57\x5e\x72\xd2\xfa\x2e\xb5\x83\xed\x16\xa1\xdc\xfc\xef\x93\x1d\x37\x3f\xda\x04\x7a\x2b\xa6\xbd\xdc\x27\x92\xfa\xf8\x9c\xef\xfb\xce\x77\x1c\x93\xe7\x10\x63\xc2\x05\xc2\x61\xcc\x59\x8a\x91\x19\xe9\xe7\x74\x94\x29\x8c\x79\xc4\x0c\x8e\x78\x7c\x08\xc7\x45\x71\x10\x24\x4b\x11\x11\x0d\x47\xfa\x39\xa5\x0f\x68\x23\xa5\x0a\x21\x3f\x08\x82\x3c\x3f\x06\x9e\xc0\x80\x4e\x7e\xa6\x13\xfd\x60\x14\x17\x33\x28\x0a\x1e\x0f\xe1\x33\xfc\x78\x09\xda\xa8\x48\x8a\x15\xbd\x32\x92\x13\x1e\x87\x36\x1e\x45\x0c\x36\x6b\xa0\xe9\x5f\x73\x54\x48\x6c\xda\x9b\x3f\x88\xa6\xd7\x24\xcf\xcb\x5c\xd7\x52\x68\xc3\x84\x81\xa2\x08\x87\xc0\xe3\x30\x3c\x08\x8a\x83\xc6\xee\x83\x1d\xd0\x8f\x64\xa6\x3d\x03\xbb\x73\x20\x33\x0b\x69\x40\x1f\x22\x99\x21\x9d\x66\x8d\x25\xa6\x66\xcd\xb5\x2b\x35\xdb\x95\xb9\xcc\xe8\x9f\x4c\x71\x16\xf3\xa8\x64\x15\x8c\x46\x76\x41\x48\x03\x4c\xcd\x96\x0b\x14\x46\xc3\x0b\x2a\x84\x4c\xc9\x15\x8f\x31\x1e\x02\xcb\x32\xcb\xc3\xcc\x11\x6e\xaf\x7e\x7b\xb8\x81\xc8\xf3\xd5\x43\x9f\x41\x73\x11\x21\xbc\x20\x44\x4c\xfc\x60\xec\x86\xf4\x15\x0e\x27\xf7\x40\xc2\x43\x0a\x9f\xe6\x5c\xc3\x0b\x4f\x53\x58\xb0\x7f\x10\x8c\x7d\xad\x98\x43\xc2\x52\xfd\x4a\x6d\x22\x9e\x40\x8a\xc2\xa9\x6a\x19\x16\x45\x08\x97\x97\x70\xe2\x08\xb4\xf5\xbf\x65\xa9\x46\x62\x65\x0e\x82\x40\xa1\x59\x2a\x61\x1f\x1d\xa1\x95\x95\xc6\x16\x22\x8f\x4f\x5c\x18\x54\x09\x8b\x30\x2f\x86\x9b\xb9\xdd\xe6\x44\x2a\xe0\x76\x83\x62\x62\x86\xb0\xf2\xb5\xf2\xbc\xcb\x27\xab\x47\xfe\x64\x9d\xb2\x61\x94\x3a\xe7\x23\x7f\x0a\xf3\x1c\x30\xd5\xe8\xc3\xe1\x12\x5a\xcb\x76\x75\x6d\x28\x07\xd7\x99\xc4\xc6\x77\xd4\x73\x9a\x74\x7a\xb3\x41\x63\x9d\xa3\xcb\xa6\x36\x4c\x66\xf4\x9e\x2d\x2c\x9e\x37\x2c\xeb\xf9\xb6\xdd\xb1\xa2\x94\xd6\x6c\x78\x5c\x61\xdf\xc3\xde\x09\xc7\x34\x6e\xba\x3b\x69\x1a\xf8\xd6\xae\xbe\x67\xe1\x9e\xf9\x4b\x36\xa8\xac\xf6\x45\xb7\x39\x7f\x7d\x08\xbf\x0f\xe7\xfe\xc3\xf9\xad\x4e\xdd\x6a\x6e\xa7\x51\xbd\x4f\xf7\xf5\x26\xc6\x33\x1c\xcd\x59\xab\xf9\xd8\x6c\xe1\x4d\x3c\xc3\x5d\x7b\x88\xf4\x6e\x7c\x07\xbe\x7d\xe6\xd4\x4d\x2e\xfd\xc4\xfe\x4e\x91\x38\x41\xd6\xa4\x4b\xd5\x9e\x53\x3a\x11\xe5\x73\x60\x4e\xfb\xc6\xb3\x5c\xaf\x6b\xba\x28\xa4\xbf\xff\xda\x88\x7a\xf4\xca\x20\x9d\xe8\x89\x58\xa1\x72\x43\x7b\x5a\xcf\xef\x49\x25\xd1\x53\x48\x6f\x95\x5c\x38\xdd\x4b\x64\x65\x3e\xf7\xdc\x2c\xec\x2b\x97\x7f\xc2\x8d\xc3\x4a\xaa\x92\xec\x14\x08\x13\xb1\x7d\x9e\x8e\xa7\xad\xfa\x21\x14\x45\x9e\x8f\x8e\xc0\x06\x7d\xfd\x0a\xc4\x06\xbc\x70\x33\x07\xee\x01\x5a\xe5\x43\x38\x1a\xbd\xab\x96\x85\x7a\x2f\xcd\xfd\x32\x4d\x49\xa5\x13\xd2\x6b\x99\x2e\x17\xa2\x05\xb9\x05\xd3\xd7\x9f\x8e\xef\xda\xf5\x99\xd6\x32\xda\xbd\xfa\x07\xf4\x6a\x1b\x29\x2d\x23\x83\x1d\x5b\xb1\x0e\xdf\xd6\xa3\x57\x8a\xce\xee\xf9\xe1\xdb\x73\x44\xac\x7a\x1f\x3f\x26\x96\x81\xfb\x08\x9f\xba\x8e\xc1\xe0\x8b\x7d\x39\x71\x2f\xc7\x1d\xae\x2e\xe3\xd7\x11\x36\xbc\xda\x6a\x19\x1d\xf7\x36\xd4\x8c\xdd\x4f\x95\xd8\xfe\x5b\xef\x6a\x08\x84\x41\xf9\xb3\x6b\xc0\x6b\xe6\xbb\xb0\x4e\x57\xc2\x44\xea\x61\x6c\x76\xa8\x4a\xe5\x8c\x57\xed\x71\x61\xf5\x5a\x8d\xae\xc4\x73\xd6\xc6\xd3\xd3\x7c\x17\x7a\xbe\x0e\xf5\xbe\x32\x67\xd5\x18\x6c\x1d\x04\x83\x2f\x6e\xcc\xbd\x69\x9c\xc3\xcc\x99\x7f\xfb\x45\x72\x41\xcc\xd8\xbf\x4d\xc5\xdb\x89\xb8\x4b\x34\x04\x33\xae\x82\x9c\x34\x1b\xb6\x2f\x21\x5e\x6c\x40\xf4\xe7\x8c\x19\x57\x57\xad\xcf\x43\xc8\xea\xdb\x96\xf5\x97\xf6\x1f\x90\x8c\x98\x8b\xb0\xba\xc3\x99\x73\xb7\x75\x4d\xf5\x62\xeb\x30\x98\x08\xd2\x3f\x83\x60\xce\xc3\xff\xe5\xb8\xaa\xfd\xd5\x1a\xfe\x2e\xc5\x36\x8f\xe0\xff\xde\x8a\xdd\xe6\xea\xf4\xe6\x6e\xfd\x1a\xd7\xfd\xea\x6b\x4d\xd7\xb9\x64\xcd\xf4\xa1\xc7\x74\x8f\xea\x1d\x47\xee\x8e\x67\xed\x47\xb1\xef\x30\x66\x83\xf9\x7e\x27\x31\x13\xef\xff\x9b\xdb\x8d\xdd\xed\xf7\x04\x32\xa2\x2d\x8e\x6f\x2f\x2f\xd5\x4e\xd5\xf9\x9b\xd5\x79\x02\x1c\x7e\x6a\xdc\x1d\xa7\x8a\xd4\x6a\xee\x8d\x4d\x48\xf3\x2e\xb8\x8c\x68\xfb\xe1\x24\x5b\xd7\xc4\x7f\x03\x00\x00\xff\xff\xdd\xb7\x61\x67\x5f\x10\x00\x00") +var _templateDialectSqlPredicateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x57\x5d\x4f\xeb\x46\x10\x7d\x36\xbf\x62\x84\x22\xd5\x46\x61\x03\x01\x5e\x2a\x51\x09\x51\x90\xd2\x16\xd2\x8a\xab\xf6\x01\xa1\xab\xad\x3d\x0e\x7b\x6b\x76\xcd\xee\x26\x08\xf9\xfa\xbf\x57\xb3\xde\xf8\x23\x71\x20\x37\xa5\xea\x4b\x9f\xb0\xb3\xb3\x33\xe7\x9c\x39\xb3\x5e\x8a\x02\x12\x4c\x85\x44\xd8\x4f\x04\xcf\x30\xb6\x23\xf3\x9c\x8d\x72\x8d\x89\x88\xb9\xc5\x91\x48\xf6\xe1\xb0\x2c\xf7\x82\x74\x2e\xe3\xd0\xc0\x81\x79\xce\xd8\x1d\x52\xa4\xd2\x11\x14\x7b\x41\x50\x14\x87\x20\x52\x18\xb0\xc9\x8f\x6c\x62\xee\xac\x16\x72\x06\x65\x29\x92\x21\x7c\x86\xef\xcf\xc1\x58\x1d\x2b\xb9\x60\x17\x56\x89\x50\x24\x11\xc5\xa3\x4c\x80\xb2\x06\x86\xfd\xf1\x88\x1a\x43\x4a\x7b\xf5\x5b\x68\xd8\x65\x58\x14\x55\xae\x4b\x25\x8d\xe5\xd2\x42\x59\x46\x43\x10\x49\x14\xed\x05\xe5\x5e\x6b\xf7\xde\x16\xe8\x47\x2a\x37\x9e\x01\xed\x1c\xa8\x9c\x20\x0d\xd8\x5d\xac\x72\x64\xd3\xbc\xb5\xc4\xf5\xac\xbd\x76\xa1\x67\xdb\x32\x57\x39\xfb\x9d\x6b\xc1\x13\x11\x57\xac\x82\xd1\x88\x16\xa4\xb2\xc0\xf5\x6c\xfe\x84\xd2\x1a\x78\x41\x8d\x90\x6b\xb5\x10\x09\x26\x43\xe0\x79\x4e\x3c\xec\x23\xc2\xf5\xc5\x2f\x77\x57\x10\x7b\xbe\x66\xe8\x33\x18\x21\x63\x84\x17\x84\x98\xcb\xef\x2c\x6d\xc8\x5e\x61\x7f\x72\x0b\x61\xb4\xcf\xe0\xd3\xa3\x30\xf0\x22\xb2\x0c\x9e\xf8\x5f\x08\x96\x5e\x6b\xe6\x90\xf2\xcc\xbc\x32\x4a\x24\x52\xc8\x50\x3a\x55\x89\x61\x59\x46\x70\x7e\x0e\x47\x8e\x40\x57\xff\x6b\x9e\x19\x0c\x49\xe6\x20\x08\x34\xda\xb9\x96\xf4\xe8\x08\x2d\x48\x1a\x2a\x14\xde\x3f\x08\x69\x51\xa7\x3c\xc6\xa2\x1c\xae\xe6\x76\x9b\x53\xa5\x41\xd0\x06\xcd\xe5\x0c\x61\xe1\x6b\x15\x45\x9f\x4f\x16\xf7\xe2\x81\x9c\xb2\x62\x94\x26\xe7\xbd\x78\x88\x8a\x02\x30\x33\xe8\xc3\xe1\x1c\x3a\xcb\xb4\xba\x34\x94\x83\xeb\x4c\x42\xf1\x3d\xf5\x9c\x26\xbd\xde\x6c\xd1\x58\xe6\xe8\xb3\x29\x85\xa9\x9c\xdd\xf2\x27\xc2\xf3\x86\x65\x3d\xdf\xae\x3b\x16\x8c\xb1\x86\x8d\x48\x6a\xec\x3b\xd8\x3b\x15\x98\x25\x6d\x77\xa7\x6d\x03\x5f\xd3\xea\x7b\x16\xde\x30\x7f\xe9\x0a\x95\xc5\xae\xe8\x56\xe7\x6f\x13\xc2\xff\x87\x73\xf7\xe1\xfc\x56\xa7\x76\x9b\x5b\xb9\x94\xd4\x70\xb1\x22\xf3\x4a\x0d\x61\xd1\x6b\x60\xef\x5f\x57\xef\x9f\x98\x17\x93\x19\x8e\x1e\x79\xc7\x1d\xd8\xee\xf1\x55\x32\xc3\x6d\x9b\x8c\xec\x66\x7c\x03\xbe\xbf\xf6\xd8\x8d\x36\xfb\xc4\xff\xcc\x30\x74\x8a\x2d\x55\xa9\x64\x7d\xce\xd8\x44\x56\xcf\x81\x3d\xde\x34\xbf\xd5\x7a\x53\xd3\x45\x21\xfb\xf5\xe7\x56\xd4\xbd\x97\x08\xd9\xc4\x4c\xe4\x02\xb5\x9b\xea\xe3\x66\xc0\x8f\x6a\x89\x1e\x22\x76\xad\xd5\x93\x6b\x4c\x85\xac\xca\xe7\x9e\xdb\x85\x7d\xe5\xea\x4f\xb4\x72\x9a\x29\x5d\x91\x9d\x42\xc8\x65\x42\xcf\xd3\xf1\xb4\x53\x3f\x72\x7d\x19\x1d\x00\x05\x7d\xfd\x0a\x21\x05\xbc\x08\xfb\x08\xc2\x03\x24\xe5\x23\x38\x18\xbd\xab\x16\x41\xbd\x55\xf6\x76\x9e\x65\x61\xad\x13\xb2\x4b\x95\xcd\x9f\x64\x07\x72\x07\xa6\xaf\x3f\x1d\xdf\x74\xeb\x73\x63\x54\xbc\x7d\xf5\x0f\xe8\xd5\x3a\x52\x56\x45\x06\x5b\xb6\x62\x19\xbe\xae\xc7\x46\x29\x7a\xbb\xe7\xa7\x73\xc7\x11\x21\xf5\x3e\x7e\x4c\x88\x81\xfb\x4a\x1f\x57\x93\x3c\xf8\x42\x2f\x47\xee\xe5\xb0\xc7\xd5\x55\xfc\x32\x82\xc2\xeb\xad\xc4\xe8\x70\x63\x43\xed\xd8\xfd\x54\x8b\xed\x2f\x03\xae\x86\x44\x18\x54\x3f\xbb\x06\xbc\xe6\xbe\x0b\xcb\x74\x15\x4c\x64\x1e\xc6\x6a\x87\xea\x54\xce\x78\xf5\x1e\x17\xd6\xac\x35\xe8\x2a\x3c\x27\x5d\x3c\x1b\x9a\xef\x42\x4f\x97\xa1\xde\x57\xf6\xa4\x1e\x83\xb5\x83\x60\xf0\xc5\x8d\xb9\x37\x8d\x73\x98\x3d\xf1\x6f\x3f\x29\x21\x43\x3b\xf6\x6f\x53\xf9\x76\x22\xe1\x12\x0d\xc1\x8e\xeb\x20\x27\xcd\x8a\xed\x2b\x88\x67\x2b\x10\xfd\x39\x63\xc7\xf5\x5d\xec\xf3\x10\xf2\xe6\x3a\x46\xfe\x32\xfe\x0b\x93\x87\xf6\x2c\xaa\x2f\x79\xf6\xd4\x6d\x5d\x52\x3d\x5b\x3b\x0c\x26\x32\xdc\x3c\x83\x60\x4f\xa3\xff\xe4\xb8\x6a\xfc\xd5\x19\xfe\x3e\xc5\x56\x8f\xe0\x7f\xdf\x8a\xfd\xe6\xea\xf5\xe6\x76\xfd\x1a\x37\xfd\xda\xd4\x9a\xbe\x73\x89\xcc\xf4\xa1\xc7\xf4\x06\xd5\x7b\x8e\xdc\x2d\xcf\xda\x8f\x62\xdf\x63\xcc\x16\xf3\xdd\x4e\x62\x2e\xdf\xff\x3f\xb8\x1f\xbb\xdb\xef\x09\xe4\xa1\x21\x1c\xdf\x5e\x5e\xe9\xad\xaa\x8b\x37\xab\x8b\x14\x04\xfc\xd0\xba\x5c\x4e\x75\xd8\xa8\xb9\x33\x36\xa9\xec\xbb\xe0\xf2\xd0\xd0\x87\x33\x5c\xbb\x26\xfe\x1d\x00\x00\xff\xff\x94\x88\xdf\x11\x80\x10\x00\x00") func templateDialectSqlPredicateTmplBytes() ([]byte, error) { return bindataRead( @@ -639,7 +639,7 @@ func templateDialectSqlPredicateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/predicate.tmpl", size: 4191, mode: os.FileMode(420), modTime: time.Unix(1565164297, 0)} + info := bindataFileInfo{name: "template/dialect/sql/predicate.tmpl", size: 4224, mode: os.FileMode(420), modTime: time.Unix(1565168189, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -664,7 +664,7 @@ func templateDialectSqlQueryTmpl() (*asset, error) { return a, nil } -var _templateDialectSqlUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5a\x5d\x6f\xdb\x3a\xd2\xbe\x96\x7f\xc5\xbc\x46\x9a\x23\x05\xae\x92\xf6\x32\xe7\x75\x81\x6e\x93\x02\xc1\xa2\x75\x4f\xdc\xb3\x7b\x91\x13\x14\xb4\x34\x4a\x88\xc8\x94\x43\xd2\x4e\xb2\x86\xfe\xfb\x62\x48\x7d\x50\xb2\x9c\xda\x71\xd0\xe6\xa0\x7b\x51\x34\x96\xf8\x31\x1f\xcf\x3c\x33\x43\x71\xb9\x84\x18\x13\x2e\x10\xfa\x31\x67\x29\x46\xfa\x50\xdd\xa6\x87\xf3\x59\xcc\x34\xf6\x21\xcf\x7b\xcb\x25\xec\xcd\x6e\xae\xe0\x78\x08\x7b\xe1\x38\xca\x66\x18\x7e\x61\xd1\x0d\xbb\xc2\xf2\xed\x64\xce\xd3\x18\x25\x8d\x98\x31\x15\xb1\xb4\x1a\xf8\x8f\xe2\x4d\x31\x50\x62\x84\x7c\x61\x47\x56\x7f\x57\xd3\x8b\x41\x99\x40\x7a\x7f\xcd\xd4\x78\x9e\x24\xfc\xbe\x1e\xd0\x1f\x89\x52\xa4\xd7\xb0\xf7\x1f\x94\x19\x0d\x3c\x82\x3c\x5f\x2e\x81\x27\x76\xaa\xf9\x61\x5f\x0e\xa1\x2f\x78\xda\xb7\x8f\x50\xc4\xd5\x54\x89\x9a\x66\xf6\x45\xbf\x6b\x2e\xbd\x25\x5d\xcf\x4b\x09\xdd\xf9\xbd\x64\x2e\x22\xf0\x1b\xda\xe4\x39\x1c\xb8\x76\xc8\xf3\x00\xd4\x6d\x3a\x66\x0b\xf4\x23\x7d\x0f\x51\x26\x34\xde\xeb\xf0\x83\xfd\x3f\x28\xa7\x6b\x9a\xd9\xd8\xde\x2c\x13\x7e\x66\xd3\x42\x16\x4c\x15\xfd\xc5\x85\xae\x24\x18\x00\x4a\x49\xff\x32\x19\xc0\xb2\xe7\x29\x24\xa7\x65\xc6\xa6\xea\x36\x0d\xc7\xe6\xb7\xd9\xc1\xf1\x53\xd8\xd8\xe6\x43\x96\xce\xa7\x42\x85\x61\x58\xef\x61\x26\x9c\x9d\x90\x90\x4a\x33\xa1\x5d\xad\x83\xf0\xa3\xcc\xa6\x3e\x2d\xff\x95\x4d\x52\x5c\x59\xdd\x3c\x0d\x82\x9e\x47\xe6\xad\xf7\xe9\x79\x5e\x7b\xe4\xd9\x49\xdb\x76\x21\x8f\x03\xbf\xd4\xa2\x58\xa2\x90\xa9\xe7\x79\x49\x26\xe1\xdb\x00\x66\x06\x32\x4c\x5c\x21\xb4\xa7\xcf\x24\xc6\x3c\x62\x1a\x15\x99\xc3\xf3\x66\xee\x62\x5e\x5e\x2c\x68\xbd\xe7\xc9\xec\x4e\xd1\x52\xfb\xa4\xcb\x79\x76\xa7\x96\x79\xcf\xbb\x9d\xa3\x7c\x18\x00\x93\x57\xe6\x5d\x39\x3d\xfc\x83\x9e\xfb\x41\xcf\xe3\x89\x31\xfa\x70\x65\xef\x58\xd2\x5f\xc5\xc0\x48\xdf\x0f\xc0\x59\x6b\x00\xb4\x5b\xf0\xbb\x99\xfb\x7f\x43\x10\x3c\x35\x12\x4a\xd4\x73\x29\xa0\x82\x69\xe1\xd3\x1e\xc9\x1a\x63\x82\xd2\xcc\x0b\x3f\xa4\x99\x42\xda\x7d\xc1\x24\xf0\x58\xc1\xc5\x25\x17\xba\x67\x2c\x62\x06\x7c\xc6\x7b\xed\x1b\x0c\x14\x43\xc0\xbc\x5f\xf5\x81\x75\x82\x03\x67\x18\xc2\x7e\x03\x69\x51\x26\x12\x7e\x75\xbc\xa2\x9f\x7d\x6e\xd6\x28\x6c\x70\x6c\x8d\xe0\xae\x66\xc0\x41\xb6\xf4\xbb\xf5\xed\xd6\x38\x99\xea\xf0\x94\x50\x9c\xf8\xfd\x92\x62\xf2\xfc\x18\x12\xc6\x53\x8c\x41\x45\x4c\x08\x2e\xae\x48\x55\xd2\x2b\x03\x57\xe0\x63\x78\xb5\xe8\x1b\xab\x91\x8f\x3d\x2b\x60\x0c\x1d\xb2\x95\xc6\x20\x68\x9f\xa9\xb1\x96\xb4\x66\x9e\xf3\xd8\x0f\x6a\xec\x9f\x9d\xd4\x01\xee\xb5\x00\xe8\x28\x6e\xac\x3e\x8e\x98\xf0\xf7\x79\xfc\x4c\x7a\x4a\x64\x31\x89\xc4\xe3\x0e\x9d\x5c\xe4\x7a\x04\x81\x21\xb0\xd9\x0c\x45\xec\xf3\x58\x0d\x80\xc7\x41\xaf\x04\x78\xc3\xe1\xea\x8e\xeb\xe8\x1a\x04\x09\x9d\xa2\xa0\xd1\xc1\xef\x46\xc6\x88\x29\x04\x01\xc3\x21\x1c\x1d\xf7\xb6\x94\xd8\x75\x00\x88\x4c\x43\x92\xcd\x45\x0c\x77\x5c\x5f\xd7\xe2\x77\x04\x77\xbd\xed\x3b\x78\xb3\xf5\xae\xd3\x4c\x22\xe8\x6b\x26\x80\xd4\x6b\xc8\x60\x76\xd6\xd7\x08\x8a\x1e\x7c\x47\x84\xbc\xcd\x2c\x3c\xa9\x6c\x63\xec\x61\x7d\xd8\x25\x9a\xe0\xe9\x2a\x93\x2c\x97\x87\x07\x64\x75\x7d\x8d\x12\x7f\x53\xa0\xb2\x29\xea\x6b\x72\xa5\xce\xc0\xa6\xcf\x01\x28\xcd\xa4\x06\x06\x5a\x32\xa1\x58\xa4\x79\x26\x42\x38\x38\xa4\xf9\x44\x16\x4e\x40\x75\xb0\xca\xd7\x7b\xa2\x94\x9a\x7e\x36\xa4\x90\x0a\xf1\x1f\x39\xa6\xb1\xb2\xca\x12\x41\xf8\xa4\x9f\x95\x0c\x26\x59\x96\x5a\x75\x95\xc9\x1a\xe7\xa8\xe6\x29\x91\x87\x57\x26\x31\x9b\x4d\xfe\x34\xc3\xd7\xf0\x7d\xf8\x6f\xd2\xdd\xa4\x85\x33\x71\x26\xb4\xea\xca\x3a\xed\xa4\x42\xb0\xa5\xcc\x43\xd9\xc2\x0b\x0a\x90\x5b\x66\xdf\xfb\x36\x80\xbd\xc4\x16\x1a\xae\xf0\x64\x80\xb6\x8d\xe8\x77\x12\x8e\xb5\x9c\x47\xda\x8c\x25\x40\x34\x82\xb1\xd0\x74\x08\x5a\xce\xd1\x3c\x29\x54\x0b\xc7\xd8\x99\x1f\xf7\x92\xa6\x9c\x07\x9b\xec\x69\x62\xb5\x83\x72\x0d\xe9\xd2\xa3\x24\xfc\x3c\x4f\x53\xb2\x57\x91\xdf\x2d\x80\x3a\x88\xaa\x2a\x9e\x92\x0a\xe1\xc3\xcd\x84\xa8\x64\xa8\xc8\xa2\x83\x3e\x92\x02\x95\xd6\x3c\xad\x9c\x57\x9a\xa6\x4a\x79\x2e\xef\xe9\xfb\xf0\xf4\x1e\xa3\x8e\x04\xb7\x2f\x71\x63\xc2\x97\x59\x9a\x4e\x58\x74\xe3\x17\xc8\xaf\x58\xce\x8d\x4c\x03\xdc\xd3\xf8\x0a\x95\xb1\xd1\xe1\x01\xa0\xd0\x26\xd0\xb3\xb9\x86\xc4\x80\x62\x00\x93\xb9\x7d\x06\x68\x46\xda\x80\x32\x18\x6f\xe3\xb9\x19\xb1\x0d\xa0\xa1\x05\x5a\xb9\x99\x93\x38\x31\xfc\xf4\xf6\x53\x0d\x3d\x62\x89\xb6\x17\x24\x4e\xb3\x05\xc6\x8e\xd3\xb0\x74\x5a\x00\xef\x4a\x32\x31\x2b\xee\x31\xa7\x4a\xdd\x9b\xd0\x8f\x37\x75\xd9\x89\xe1\x99\x3a\x13\x0b\x94\x55\x11\xc6\xa0\x1a\xb0\x37\x81\x6a\x66\xed\x5a\x0f\x29\x15\x1c\x0f\x61\xca\x6e\xd0\x37\x55\xc1\x60\x6b\x21\x2d\x6e\xa9\x96\x40\x1e\xaf\x2f\xae\x1e\x59\xa2\x50\xd1\xe8\xa8\x71\x3a\x4b\x09\x5b\x1d\x4d\xc4\x61\x94\x91\x7e\x9a\xc7\x7d\x32\xfa\xeb\x32\x3e\xb0\x91\xd0\xd0\x64\x34\xb4\x5c\x5d\x64\xf4\x95\xc2\xec\x36\x0d\x4f\x30\xc5\x0e\x42\xa2\xdf\x68\x69\xc9\x89\xe1\x20\xb4\x5b\x6d\xc4\x53\x18\x7e\xf9\xa7\x33\xf7\xc2\xfa\x22\xcf\x2f\x6b\xc6\xda\x75\xb9\x89\x5d\x0e\x5b\xeb\x39\x41\xb7\x53\xd4\x6d\x1e\x76\x5e\xde\xa0\x2d\xa4\xae\x21\x39\xc7\xa4\x0c\x3a\xc2\xbf\x09\x30\x85\x69\x02\x92\x8a\x52\x14\x11\x9a\x48\x33\x03\xbe\x8e\x4e\x46\xc7\x30\x57\x08\xa3\x73\xe0\xc2\x64\x61\x93\xe4\xd9\x24\x5b\x60\x99\xe3\xda\x3e\xdc\xc1\x85\x3b\x1b\xbd\x65\xf3\x9d\x31\xd1\x76\x62\xc3\x8b\x3b\xfa\x71\x1b\x4f\xba\xbe\xec\xa0\xff\x92\x54\x31\x1c\x3d\x13\xa7\xfd\xca\xec\xb3\xa6\x1c\x7a\x1c\xba\x63\xd4\x54\x02\xac\x99\x65\x7b\xf1\xa7\x93\xd6\xca\xfc\xcd\xe8\x0a\xc3\xaf\x0f\x8d\x93\x9c\xd0\x79\xda\xae\xd8\x5e\x0a\x61\xb5\xba\x33\xc3\x44\xa3\xb7\x23\xc8\x24\x7c\x7a\x3b\xaa\x48\xa7\xa3\x5c\x8c\x52\x64\xf2\x51\x24\xbd\x44\x6f\x6f\xe5\xa4\x17\xe2\xa3\xf5\x49\x85\x3c\xb5\x2e\xa9\xac\xcb\x15\x4f\x72\xc1\x53\x7d\xf0\x7c\x21\xd7\x4c\x06\xbb\xe5\x82\x2d\x52\xc1\xa6\x8d\x40\x17\x5d\x5b\xd5\x5a\xcd\x4d\x4d\xfb\x85\x57\x99\x88\x69\xd8\x9f\x82\xdf\xce\xf1\x29\x3e\xe6\x49\xfb\x58\xc2\x1c\x0b\x6c\x0c\xb6\x75\xc7\x04\x11\x13\xbf\x69\x48\xb9\xb8\x31\x32\x50\x63\x00\x7f\xf5\xad\x52\x45\xa0\xff\xd5\xa7\xd6\xfc\x55\x0c\x26\x1f\x44\xa8\xc0\x7f\x07\x6f\x82\xfe\x00\x44\xe0\x02\xf8\xbb\x69\xa9\xcb\x54\xbb\xe6\xa3\xe7\xa2\x1f\x03\xfe\xcd\x71\x4b\x29\xaf\x9a\x59\xc3\xff\xf4\x8f\x8d\x5b\xf9\x8b\xa3\xcb\x20\x08\x7f\x26\xde\x9f\x8d\x36\xb6\x33\x5d\xa1\xfb\x7a\xeb\x6d\x9b\x62\x83\xf0\xbd\x88\xfd\x20\x3c\x53\x5b\x91\xd7\x4f\x36\x3e\x4b\x12\x8c\x34\xc6\xd5\x69\x96\x44\x65\x4e\xd6\xdf\x17\x2f\x5a\x82\xed\xbc\x21\x4f\x80\x0b\xed\x97\xfb\x06\xf0\xff\x5b\xf0\xd9\xc6\xdb\xee\x9f\x4a\x69\xac\x2c\x19\x17\xfa\xa3\x39\xac\x5d\x4e\xd5\xd5\xb1\x61\xa0\xf1\x4c\x72\xa1\x13\xbf\xbf\x4a\x31\xfe\xab\x45\x00\x2c\x95\xc8\xe2\x07\x88\x32\x21\x8c\x94\xc4\x3c\x0c\x62\x9e\x18\x42\xd4\x05\x35\xd5\xd3\xfa\x16\x01\x79\x43\xd5\xbc\x24\x5e\xa7\x8a\xa7\xce\xac\x3c\x07\x58\xb0\x74\x8e\x6e\x2d\x5e\x54\xe3\x47\x83\x8a\x5e\xeb\x42\xfb\x1b\x21\xb6\xe6\x34\x2a\x7f\x0b\x63\xec\xc4\x77\x4f\x26\xbc\x52\xfa\xaa\x06\xb7\xbf\x07\xf6\x33\xc7\x92\xc7\xc6\x22\xf9\x00\xba\xea\x09\x3b\x06\x69\x10\x8f\x9d\xef\x54\x26\x07\x51\xea\x79\x2d\x31\x81\x48\xa2\xf9\x2c\x44\xcd\xa9\x3d\x29\xe2\x02\x26\x99\xbe\x86\x3b\xf6\xa0\xdc\x26\x35\x6f\xd5\x2f\xcf\x7f\x66\xe3\x7c\x23\xb5\xf5\x85\x42\xb9\x8e\x6c\xd6\x11\x54\xf1\xd9\x6e\xdb\x4e\x75\xab\x46\xb9\x01\x98\x45\x8d\x89\xc2\x5b\x85\xd7\xcb\xe3\xc2\x7f\x99\xa7\xfe\xe2\xe2\xe8\x72\x00\x8b\x8b\x37\x97\x8f\xf4\x4f\x1d\x47\x8c\x3f\xb4\x30\x5d\x09\xa4\x51\xe9\x9b\xbf\x77\xc2\x7f\x72\xbe\xdf\xed\xf4\xfe\x25\x54\xba\x5d\x7e\xad\x8f\x39\xbe\x43\x7b\xb3\xd2\xec\x5f\x4a\xe9\x7f\x12\x11\xce\xc2\x91\xf4\x83\x27\x57\x0d\x6b\x4b\xa1\x1f\x87\xaa\x4e\x50\x51\x31\x33\x1b\x58\xb6\xdb\xb2\xa2\x79\x11\xe0\xfa\xc5\x2b\x9b\x4c\x20\x64\x49\x47\x0f\xf5\x6a\xf1\xa4\xf2\xe6\x06\x1f\xd4\x66\xaa\x3c\x5a\x05\x39\x7d\x66\x95\xbe\x1f\x8f\xf3\xea\x7b\x68\x19\x41\xce\x35\x80\xc2\x66\xa6\x90\x50\x85\x97\x95\x96\x14\xa9\xe1\x7b\x9d\x71\x7f\x73\xa9\xa9\x17\xa8\xcf\x7e\xd5\xf3\x1c\xea\xb6\xef\x22\x58\x59\x49\xca\xad\x04\x73\xd6\xaa\x2b\x12\xe7\xa0\xc6\x2d\x67\x8a\x6d\xfe\xae\xfd\xe8\x93\x9b\xa8\x72\xd3\x06\xe5\xac\x9a\xff\x27\xd9\xe5\x51\xb3\xfc\xb0\x46\x73\xbd\x8d\x1c\x58\xfd\x8f\xa6\x7f\x71\x9a\x2e\xb1\xd0\xba\x30\x53\x5d\xa2\xd3\xf7\xe1\x87\x6c\x3a\xe5\xda\xdf\xee\x6e\x5c\xfd\xae\x79\x5f\xb3\x7d\x51\xd3\xc6\x6b\xd9\x01\x3b\x17\x27\x05\x4f\x7b\x79\xaf\xe7\x5c\xe6\x7c\xf4\xf6\xab\x5b\xb0\xe5\xee\xc5\x9a\xee\x44\xb2\x3e\x89\x14\x55\x5a\x57\x5a\xb0\x16\x69\x38\x5e\x95\x80\xab\xf4\x3d\x3c\x80\xe2\x6f\xae\xcc\xc5\xab\x1b\x71\x97\x09\x60\x1a\xf4\x35\x57\x30\xcb\xb8\xd0\x55\x37\xdb\xb4\x7a\xa5\xeb\x7f\x03\x00\x00\xff\xff\xbb\xec\xc5\x79\xe8\x2b\x00\x00") +var _templateDialectSqlUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5a\x5d\x6f\xdb\x3a\xd2\xbe\x96\x7f\xc5\xbc\x46\x9a\x23\x05\xae\x92\xf6\x32\xe7\x75\x81\x6e\x93\x02\xc1\xa2\x75\x4f\xdc\xb3\x7b\x91\x13\x14\xb4\x34\x4a\x88\xc8\x94\x43\xd2\x4e\xb2\x86\xfe\xfb\x62\x48\x7d\x50\xb2\x9c\xda\x71\xd0\xe6\xa0\x7b\x11\xc4\x92\x48\xce\xd7\x33\xcf\x0c\x29\x2d\x97\x10\x63\xc2\x05\x42\x3f\xe6\x2c\xc5\x48\x1f\xaa\xdb\xf4\x70\x3e\x8b\x99\xc6\x3e\xe4\x79\x6f\xb9\x84\xbd\xd9\xcd\x15\x1c\x0f\x61\x2f\x1c\x47\xd9\x0c\xc3\x2f\x2c\xba\x61\x57\x58\x3e\x9d\xcc\x79\x1a\xa3\xa4\x11\x33\xa6\x22\x96\x56\x03\xff\x51\x3c\x29\x06\x4a\x8c\x90\x2f\xec\xc8\xea\x77\x35\xbd\x18\x94\x09\xa4\xe7\xd7\x4c\x8d\xe7\x49\xc2\xef\xeb\x01\xfd\x91\x28\x55\x7a\x0d\x7b\xff\x41\x99\xd1\xc0\x23\xc8\xf3\xe5\x12\x78\x62\xa7\x9a\x0b\xfb\x70\x08\x7d\xc1\xd3\xbe\xbd\x85\x22\xae\xa6\x4a\xd4\x34\xb3\x2f\xfa\x5d\x73\xe9\x29\xd9\x7a\x5e\x6a\xe8\xce\xef\x25\x73\x11\x81\xdf\xb0\x26\xcf\xe1\xc0\xf5\x43\x9e\x07\xa0\x6e\xd3\x31\x5b\xa0\x1f\xe9\x7b\x88\x32\xa1\xf1\x5e\x87\x1f\xec\xff\xa0\x9c\xae\x69\x66\x43\xbc\x59\x26\xfc\xcc\xa6\x85\x2e\x98\x2a\xfa\xc5\x85\xae\x34\x18\x00\x4a\x49\x7f\x99\x0c\x60\xd9\xf3\x14\x52\xd0\x32\xe3\x53\x75\x9b\x86\x63\x73\x6d\x24\x38\x71\x0a\x1b\x62\x3e\x64\xe9\x7c\x2a\x54\x18\x86\xb5\x0c\x33\xe1\xec\x84\x94\x54\x9a\x09\xed\x5a\x1d\x84\x1f\x65\x36\xf5\x69\xf9\xaf\x6c\x92\xe2\xca\xea\xe6\x6e\x10\xf4\x3c\x72\x6f\x2d\xa7\xe7\x79\xed\x91\x67\x27\x6d\xdf\x85\x3c\x0e\xfc\xd2\x8a\x62\x89\x42\xa7\x9e\xe7\x25\x99\x84\x6f\x03\x98\x19\xc8\x30\x71\x85\xd0\x9e\x3e\x93\x18\xf3\x88\x69\x54\xe4\x0e\xcf\x9b\xb9\x8b\x79\x79\xb1\xa0\x8d\x9e\x27\xb3\x3b\x45\x4b\xed\x93\x2d\xe7\xd9\x9d\x5a\xe6\x3d\xef\x76\x8e\xf2\x61\x00\x4c\x5e\x99\x67\xe5\xf4\xf0\x0f\xba\xef\x07\x3d\x8f\x27\xc6\xe9\xc3\x15\xd9\xb1\xa4\x5f\xc5\xc0\x48\xdf\x0f\xc0\x59\x6b\x00\x24\x2d\xf8\xdd\xcc\xfd\xbf\x21\x08\x9e\x1a\x0d\x25\xea\xb9\x14\x50\xc1\xb4\x88\x69\x8f\x74\x8d\x31\x41\x69\xe6\x85\x1f\xd2\x4c\x21\x49\x5f\x30\x09\x3c\x56\x70\x71\xc9\x85\xee\x19\x8f\x98\x01\x9f\xf1\x5e\xfb\x06\x03\xc5\x10\x30\xcf\x57\x63\x60\x83\xe0\xc0\x19\x86\xb0\xdf\x40\x5a\x94\x89\x84\x5f\x1d\xaf\xd8\x67\xef\x9b\x35\x0a\x1f\x1c\x5b\x27\xb8\xab\x19\x70\x90\x2f\xfd\x6e\x7b\xbb\x2d\x4e\xa6\x3a\x3c\x25\x14\x27\x7e\xbf\xa4\x98\x3c\x3f\x86\x84\xf1\x14\x63\x50\x11\x13\x82\x8b\x2b\x32\x95\xec\xca\xc0\x55\xf8\x18\x5e\x2d\xfa\xc6\x6b\x14\x63\xcf\x2a\x18\x43\x87\x6e\xa5\x33\x08\xda\x67\x6a\xac\x25\xad\x99\xe7\x3c\xf6\x83\x1a\xfb\x67\x27\x75\x82\x7b\x2d\x00\x3a\x86\x1b\xaf\x8f\x23\x26\xfc\x7d\x1e\x3f\x93\x9d\x12\x59\x4c\x2a\xf1\xb8\xc3\x26\x17\xb9\x1e\x41\x60\x08\x6c\x36\x43\x11\xfb\x3c\x56\x03\xe0\x71\xd0\x2b\x01\xde\x08\xb8\xba\xe3\x3a\xba\x06\x41\x4a\xa7\x28\x68\x74\xf0\xbb\xd1\x31\x62\x0a\x41\xc0\x70\x08\x47\xc7\xbd\x2d\x35\x76\x03\x00\x22\xd3\x90\x64\x73\x11\xc3\x1d\xd7\xd7\xb5\xfa\x1d\xc9\x5d\x8b\x7d\x07\x6f\xb6\x96\x3a\xcd\x24\x82\xbe\x66\x02\xc8\xbc\x86\x0e\x46\xb2\xbe\x46\x50\x74\xe3\x3b\x2a\xe4\x6d\x66\xe1\x49\xe5\x1b\xe3\x0f\x1b\xc3\x2e\xd5\x04\x4f\x57\x99\x64\xb9\x3c\x3c\x20\xaf\xeb\x6b\x94\xf8\x9b\x02\x95\x4d\x51\x5f\x53\x28\x75\x06\xb6\x7c\x0e\x40\x69\x26\x35\x30\xd0\x92\x09\xc5\x22\xcd\x33\x11\xc2\xc1\x21\xcd\x27\xb2\x70\x12\xaa\x83\x55\xbe\xde\x13\xa5\xd4\xf4\xb3\x21\x85\x54\x88\xff\xc8\x31\x8d\x95\x35\x96\x08\xc2\x27\xfb\xac\x66\x30\xc9\xb2\xd4\x9a\xab\x4c\xd5\x38\x47\x35\x4f\x89\x3c\xbc\xb2\x88\xd9\x6a\xf2\xa7\x19\xbe\x86\xef\xc3\x7f\x93\xed\xa6\x2c\x9c\x89\x33\xa1\x55\x57\xd5\x69\x17\x15\x82\x2d\x55\x1e\xaa\x16\x5e\x50\x80\xdc\x32\xfb\xde\xb7\x01\xec\x25\xb6\xd1\x70\x95\x27\x07\xb4\x7d\x44\xd7\x49\x38\xd6\x72\x1e\x69\x33\x96\x00\xd1\x48\xc6\xc2\xd2\x21\x68\x39\x47\x73\xa7\x30\x2d\x1c\x63\x67\x7d\xdc\x4b\x9a\x7a\x1e\x6c\x22\xd3\xe4\x6a\x07\xe5\xd6\xf7\x92\xf0\xf3\x3c\x4d\xc9\x61\xd5\xa3\x15\x42\xa6\xa5\xcb\xd6\x29\xa9\xf0\xbd\x8a\x8c\x2e\x0d\x6a\x69\x0e\x69\x6d\x21\x63\x23\x33\x1d\x21\xa2\xba\x6e\x5e\xae\x12\x56\x52\xe4\x81\x0d\x48\xab\xca\x96\xc1\xa8\x8a\xac\xcb\xb4\xfa\x3e\x3c\xbd\xc7\xa8\xa3\xa4\xee\x4b\xdc\xb8\xc4\xc8\x2c\x4d\x27\x2c\xba\xf1\x8b\x5c\xab\x78\xd5\xe5\x02\x93\x2a\xa7\xf1\x15\x2a\xd3\xf1\x1c\x1e\x00\x0a\x6d\xa8\x25\x9b\x6b\x48\x0c\x0c\x07\x30\x99\xdb\x7b\x80\x66\xa4\x4d\x61\x93\x55\xed\x0c\x6a\x72\x44\x03\xda\x68\xa1\x5d\x0a\x73\x4a\x35\x86\x9f\xde\x7e\xaa\xc1\x4e\xbc\xd4\x8e\x8a\xc4\x69\xb6\xc0\xd8\x09\x22\x96\x41\x0c\xe0\x5d\x49\x5f\x66\xc5\x3d\xe6\xf4\xc5\x7b\x13\xba\x78\x53\x37\xba\x18\x9e\xa9\x33\xb1\x40\x59\xb5\x7d\x0c\xaa\x01\x7b\x13\xa8\x66\x3a\x91\x46\x2a\x3e\xc7\x43\x98\xb2\x1b\xf4\x4d\x1f\x32\xd8\x5a\x49\x9b\x29\xd4\xbd\x20\x8f\xd7\xb7\x73\x8f\x2c\x51\x98\x68\x6c\xd4\x38\x9d\xa5\x84\xad\x8e\x6d\xcb\x61\x94\x91\x7d\x9a\xc7\x7d\x72\xfa\xeb\x12\xbe\xd8\x28\xa1\x68\x6a\x28\xda\xea\x50\xf4\x10\x2b\xad\xe0\x6d\x1a\x9e\x60\x8a\x1d\x14\x48\xd7\x68\x89\xd0\x61\x8d\x20\xb4\xa2\x36\x62\x46\x0c\xbf\xfc\xd3\x99\x7b\x61\x63\x91\xe7\x97\x35\x47\xee\xba\xdc\xc4\x2e\x87\xad\xf5\x9c\xa4\xdb\x29\xeb\x36\x4f\x3b\x2f\x6f\x10\x25\xd2\x3e\x25\x39\xc7\xa4\x4c\x3a\xc2\xbf\x49\x30\x85\x69\x02\x92\xda\x60\x14\x11\x9a\x4c\x33\x03\xbe\x8e\x4e\x46\xc7\x30\x57\x08\xa3\x73\xe0\xc2\xd4\x7d\xd3\x56\xb0\x49\xb6\xc0\xb2\xaa\xb6\x63\xb8\x43\x08\x77\x76\x7a\xcb\xe7\x3b\x63\xa2\x1d\xc4\x46\x14\x77\x8c\xe3\x36\x91\x74\x63\xd9\x41\xff\x25\xa9\x62\x38\x7a\x26\x4e\xfb\x95\xd9\x67\x4d\x03\xf6\x38\x74\xc7\xa8\xa9\xe7\x58\x33\xcb\xee\xfe\x9f\x4e\x5a\x2b\xf3\x37\xa3\x2b\x0c\xbf\x3e\x34\xce\x8e\x42\xe7\x6e\xbb\x47\x7c\x29\x84\xd5\xda\x0f\x1a\x26\x1a\xbd\x1d\x41\x26\xe1\xd3\xdb\x51\x45\x3a\x1d\x0d\x6a\x94\x22\x93\x8f\x22\xe9\x25\x46\x7b\xab\x20\xbd\x90\x18\xad\x2f\x2a\x14\xa9\x75\x45\x65\x5d\xad\x78\x52\x08\x9e\x1a\x83\xe7\x4b\xb9\x66\x31\xd8\xad\x16\x6c\x51\x0a\x36\xdd\x08\x74\xd1\xb5\x35\xad\xb5\x9d\xaa\x69\xbf\x88\x2a\x13\x31\x0d\xfb\x53\xf0\xdb\x39\x3e\x25\xc6\x3c\x69\x1f\x84\x98\x83\x88\x8d\xc1\xb6\xee\x60\x22\x62\xe2\x37\x0d\x29\x17\x37\x46\x07\xda\x18\xc0\x5f\x7d\x6b\x54\x91\xe8\x7f\xf5\x41\x67\xf0\x2a\x06\x53\x0f\x22\x54\xe0\xbf\x83\x37\x41\x7f\x00\x22\x70\x01\xfc\xdd\xb2\xd4\xe5\xaa\x5d\xeb\xd1\x73\xd1\x8f\x01\xff\xe6\xb8\xa5\x92\x57\xcd\xac\xe1\x7f\xfa\xc7\xc6\x87\x07\x17\x47\x97\x41\x10\xfe\x4c\xbc\x3f\x1b\x6d\x6c\xe7\xba\xc2\xf6\xf5\xde\xdb\xb6\xc4\x06\xe1\x7b\x11\xfb\x41\x78\xa6\xb6\x22\xaf\x9f\xec\x7c\x96\x24\x18\x69\x8c\xab\xf3\x33\x89\xca\x9c\xe5\xbf\x2f\x1e\xb4\x14\xdb\x59\x20\x4f\x80\x0b\xed\x97\x72\x03\xf8\xff\x2d\xf8\x6c\x63\xb1\xfb\xa7\x52\x1a\x2f\x4b\xc6\x85\xfe\x68\x8e\x87\x97\x53\x75\x75\x6c\x18\x68\x3c\x93\x5c\xe8\xc4\xef\xaf\x52\x8c\xff\x6a\x11\x00\x4b\x25\xb2\xf8\x01\xa2\x4c\x08\xa3\x25\x31\x0f\x83\x98\x27\x86\x10\x75\x41\x4d\xf5\xb4\xbe\x45\x40\xde\x30\x35\xef\x79\x2b\x5d\x3c\xed\xcc\xca\x73\x80\x05\x4b\xe7\xe8\xf6\xe2\x45\x37\x7e\x34\xa8\xe8\xb5\x6e\xb4\xbf\x11\x62\x6b\x4e\xa3\xf6\xb7\x70\xc6\x4e\x7c\xf7\x64\xc2\x2b\xb5\xaf\x7a\x70\x7b\x3d\xb0\x2f\x56\x96\x3c\x36\x1e\xc9\x07\xd0\xd5\x4f\xd8\x31\x48\x83\x78\xec\xbc\x19\x33\x35\x88\x4a\xcf\x6b\x89\x09\x44\x12\xcd\x8b\x28\xda\x9c\xda\x93\x22\x2e\x60\x92\xe9\x6b\xb8\x63\x0f\xca\xdd\xa4\xe6\xad\xfe\xe5\xf9\xcf\x6c\x9c\xb7\xb2\xb6\xbf\x50\x28\xd7\x91\xcd\x3a\x82\x2a\x5e\x14\x6e\xbb\x53\xdd\x6a\xa3\xdc\x00\xcc\xa2\xc6\x44\x11\xad\x22\xea\xe5\x71\xe1\xbf\xcc\x5d\x7f\x71\x71\x74\x39\x80\xc5\xc5\x9b\xcb\x47\xf6\x4f\x1d\x47\x8c\x3f\xb4\x31\x5d\x49\xa4\x51\x19\x9b\xbf\x77\xc1\x7f\x72\xbd\xdf\xed\x7d\xc1\x4b\xe8\x74\xbb\xe2\x5a\x1f\x73\x7c\x87\xf6\x66\xa5\xdb\xbf\x94\xda\xff\x24\x22\x9c\x85\x23\xe9\x07\x4f\xee\x1a\xd6\xb6\x42\x3f\x0e\x55\x9d\xa0\xa2\x66\x66\x36\xb0\x6c\xb7\x65\x47\xf3\x22\xc0\xf5\x8b\x77\x36\x99\x40\xc8\x92\x8e\x3d\xd4\xab\xc5\x93\xda\x9b\x1b\x7c\x50\x9b\x99\xf2\x68\x17\xe4\xec\x33\xab\xf2\xfd\x78\x9e\x57\x6f\x60\xcb\x0c\x72\x3e\x3c\x28\x7c\x66\x1a\x09\x55\x44\x59\x69\x49\x99\x1a\xbe\xd7\x19\xf7\x37\xd7\x9a\xf6\x02\xf5\xd9\xaf\x7a\x9e\x43\xdd\x8e\x17\x89\x05\x41\x6d\xa5\x98\xb3\x96\x88\x57\x5e\x89\x36\xdb\x99\x42\xcc\xdf\x75\x3f\xfa\xe4\x4d\x54\x29\xb4\x41\x39\xab\xee\xff\x49\x7e\x79\xd4\x2d\x3f\x6c\xa3\xb9\xde\x47\x0e\xac\xfe\x47\xd3\xbf\x38\x4d\x97\x58\x68\x7d\xa2\x53\x7d\xb6\xa7\xef\xc3\x0f\xd9\x74\xca\xb5\xbf\xdd\xd7\x78\xf5\xb3\xe6\x17\xa2\xed\x4f\x43\x6d\xbe\x96\x3b\x60\xe7\x53\x4d\xc1\xd3\x5e\xde\xeb\x39\x9f\x8f\x3e\xfa\xbd\xad\xdb\xb0\xe5\xee\xa7\x3c\xdd\x85\x64\x7d\x11\x29\xba\xb4\xae\xb2\x60\x3d\xd2\x08\xbc\x2a\x01\x57\xd9\x7b\x78\x00\xc5\x6f\xae\xcc\xa7\x5e\x37\xe2\x2e\x13\xc0\x34\xe8\x6b\xae\x60\x96\x71\xa1\xab\xdd\x6c\xd3\xeb\x95\xad\xff\x0d\x00\x00\xff\xff\x2e\x27\xac\xfd\x5a\x2c\x00\x00") func templateDialectSqlUpdateTmplBytes() ([]byte, error) { return bindataRead( @@ -679,7 +679,7 @@ func templateDialectSqlUpdateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/update.tmpl", size: 11240, mode: os.FileMode(420), modTime: time.Unix(1563979564, 0)} + info := bindataFileInfo{name: "template/dialect/sql/update.tmpl", size: 11354, mode: os.FileMode(420), modTime: time.Unix(1565169540, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -864,7 +864,7 @@ func templateTxTmpl() (*asset, error) { return a, nil } -var _templateWhereTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x57\x4d\x6f\xe3\x36\x10\x3d\x4b\xbf\x62\x20\x28\xa8\x04\x24\x14\x7a\x2d\xb0\x87\x00\xde\x62\x7d\x49\xb6\x1f\x68\x0f\x41\x50\x70\xa5\x91\x4c\x44\x26\xb9\x24\xad\xec\x82\xd5\x7f\x2f\x48\xca\x92\xb2\xb6\xb3\x36\x92\xa0\x1b\xe4\x66\x91\x33\xc3\x99\xf7\x1e\x9f\x41\x6b\xa1\xc2\x9a\x71\x84\xe4\x7e\x85\x0a\x13\xe8\xfb\x38\xb6\xf6\x02\xee\x99\x59\x01\x7e\x31\xc8\x2b\x48\x21\xf9\x48\xcb\x3b\xda\x60\x02\x29\x19\x7e\xc2\x45\xdf\xc7\x91\xb5\x60\x70\x2d\x5b\x6a\x10\x92\x15\xd2\x0a\x55\x02\xc4\x55\xb1\x16\x5c\x6e\xa8\x37\x0b\x62\x6b\x29\x94\x49\x20\xf5\x5b\x45\x01\xcb\x05\xd4\xac\x35\xa8\x34\x74\xa8\x0c\x2b\x51\xc3\x27\xaa\xb1\x02\xc1\xc1\xac\x90\x29\x60\x15\x72\xc3\x6a\x86\x8a\xc4\xf5\x86\x97\xb0\x5c\x64\xac\x02\x6b\x21\x25\xcb\x05\xf9\xf3\xab\x44\xe8\xfb\x1c\xa4\xc2\x8a\x95\xd4\x20\xf1\x5b\x57\x74\xed\xd6\xc1\xc6\x91\x42\xb3\x51\xfc\x40\x80\xb5\xc0\x6a\x68\x0c\x64\x2d\x72\x48\xc9\x1f\x46\x28\xda\x60\x0e\x3f\x43\xdf\x7f\x44\xb5\x60\xb4\xc5\xd2\x8c\x13\x65\x71\xe4\x06\x57\x94\x37\x08\xe9\x3f\xe7\x90\xea\x90\x01\xbf\xbc\x9b\xd2\x03\x40\x3e\x32\x35\x6b\xd9\xba\x4d\xa9\x18\x37\x35\x24\x55\xa8\x58\x9c\xe9\x62\x6c\xa9\x60\x55\x32\x55\xda\xe6\x5e\xc0\x97\x11\xbb\x50\xc6\x01\x77\x1e\x3a\x70\xed\xf8\x53\xf2\x38\xc0\x3c\x6b\x49\x48\x77\xa0\x90\xda\x63\x04\x03\x59\x29\x55\x8d\x5b\x4f\xdc\x61\xdb\xc9\x53\x21\xc9\x5f\x54\x31\x5a\xb1\x32\x2c\xfa\x30\x1f\xa5\x87\xb0\x81\x4b\x5f\xc3\x53\x30\x9b\x66\xb9\x38\xd3\x89\xaf\x32\x00\x1a\x47\x45\x01\x63\x64\xdf\x03\x95\xb2\x65\xa8\x1d\x9d\x7e\x7d\x0a\x9d\x28\x19\xe8\x0e\x7a\xc0\xb6\x22\x71\xe4\xd3\x67\x75\xb2\x6d\x6b\x8e\xd4\x7d\xad\x13\x42\xc6\x5e\x4f\x50\xc7\xf3\xcb\xe3\x04\x7d\x44\x7b\xae\xdb\xa5\x6a\x92\x30\x69\x72\x2d\x3d\xb4\x63\xf4\x29\x7a\x2a\x84\xd4\x3b\x9a\xda\xaf\x2a\x32\xa8\xea\xa1\xae\xbe\xf9\xca\xe3\xe8\xdb\x8b\x3d\x1b\xb2\x0e\xe3\xfd\xea\xc8\xd3\xbb\x62\xa1\xba\xa4\x2d\xa4\xf5\x77\x45\x82\x9f\x37\xb4\x65\xe6\x2b\x94\x2b\x2c\xef\x76\x05\x62\x2d\x7c\xde\x08\xd7\xf9\x58\x6b\x50\x0c\x2c\xcd\x4f\x7a\x70\x0b\x77\x98\x11\xf3\x03\xde\xff\xb6\x4f\x52\x5d\xf8\x7a\x95\x32\xf1\x50\x27\x0e\xf9\xd3\xd5\x51\x0f\xb9\xff\xa7\x38\x76\xec\x2a\xf3\x7e\x55\xe7\x3b\x76\xd5\x1d\xe3\x56\xdd\x77\xcd\x0a\xb2\x87\x32\xcc\x21\xdb\x7a\x51\xfe\x54\xdf\x3a\x2c\xcb\x67\x30\xb2\xe3\xf4\xe9\xb8\xdb\xad\xe5\x98\xea\x1c\x04\x6b\x7a\x87\xd9\xcd\x2d\xe3\x06\x55\x4d\x4b\xb4\xfd\x39\xb4\xc8\x67\xcd\xe4\xb9\x0b\xae\x85\x02\xe6\x12\x02\x3f\x9d\xaf\x1d\x45\xdd\x0d\xbb\x85\x77\x30\x45\xdf\xb0\x5b\xb7\xd1\x0f\x27\x6f\x51\xff\xe1\xae\xc9\xcc\x4d\xa7\x1b\xf3\x04\x63\xf5\xac\xbe\x88\xb7\x46\x93\x78\x0f\xde\xa4\x61\xee\xf7\x55\x83\x87\x5d\x16\x03\xdc\xff\x8e\x83\x7c\xa0\xfa\xcc\x5f\x8f\x47\x35\xfe\x81\x6a\x57\xf7\x31\x71\xe3\xa8\x38\xac\x1a\xdc\xa7\xed\x57\x65\xa1\x6e\xdc\xc4\x81\x7a\xba\x0c\xdc\xfc\xc5\x8a\xbe\x8c\x0a\x02\x9a\x53\x07\x67\xfa\x6f\x66\x56\xc9\x88\xf2\xf3\xd2\x18\x50\xa1\xd0\xb0\x0e\x39\x94\x82\x57\xcc\x30\xc1\x35\x64\xc2\xac\x50\x4d\x85\x74\xbe\x8f\x71\xb7\xad\x81\x10\xf2\x90\x56\xf4\xa6\xb5\x3d\xe8\xad\xc9\xe2\x3e\xf0\xf5\x62\xff\xaf\x45\x01\x97\xbc\x82\x46\x89\x8d\xd4\xd0\x32\x6d\x40\xd4\x33\xa6\xc2\x48\x8e\xf5\xcb\xab\x05\x08\x89\x8a\x1a\xa1\xe0\x13\x9a\x7b\x44\x2f\x87\xf5\xf0\x9a\xba\xe4\x55\x36\xcb\xdb\xe1\xf1\x18\x06\x5f\xc3\x03\x8b\xf2\xe3\x5e\x58\xe4\xd0\x0b\xab\x28\xe0\x5a\x1d\x83\xf8\xf5\xef\x8f\x02\x7e\xad\xde\x04\xde\x42\x3d\x19\xee\x2b\x61\x1e\x38\x1b\x17\x66\x42\x76\x30\xb5\x60\x5a\x13\x12\x01\xe3\x2b\x61\x32\x79\x00\x9f\xd7\x0e\x2c\x17\xe6\x69\xc8\x4e\x36\xf2\x5f\x00\x00\x00\xff\xff\x21\x96\x69\xf1\x02\x12\x00\x00") +var _templateWhereTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x57\x4d\x6f\xe3\x36\x10\x3d\x4b\xbf\x62\x20\x28\xa8\x04\x24\x14\x7a\x2d\xb0\x87\x00\xde\x62\x7d\x49\xb6\x1f\x68\x0f\x41\x50\x70\xa5\x91\x4c\x44\x26\xb9\x24\xad\xec\x82\xd5\x7f\x2f\x48\xca\x92\x12\xdb\x59\x1b\xd9\xa0\x1b\xe4\x16\x91\x33\xc3\x99\xf7\x1e\x5f\x4c\x6b\xa1\xc2\x9a\x71\x84\xe4\x7e\x85\x0a\x13\xe8\xfb\x38\xb6\xf6\x02\xee\x99\x59\x01\x7e\x31\xc8\x2b\x48\x21\xf9\x48\xcb\x3b\xda\x60\x02\x29\x19\xfe\x84\x8b\xbe\x8f\x23\x6b\xc1\xe0\x5a\xb6\xd4\x20\x24\x2b\xa4\x15\xaa\x04\x88\xab\x62\x2d\xb8\xdc\x50\x6f\x16\xc4\xd6\x52\x28\x93\x40\xea\xb7\x8a\x02\x96\x0b\xa8\x59\x6b\x50\x69\xe8\x50\x19\x56\xa2\x86\x4f\x54\x63\x05\x82\x83\x59\x21\x53\xc0\x2a\xe4\x86\xd5\x0c\x15\x89\xeb\x0d\x2f\x61\xb9\xc8\x58\x05\xd6\x42\x4a\x96\x0b\xf2\xe7\x57\x89\xd0\xf7\x39\x48\x85\x15\x2b\xa9\x41\xe2\xb7\xae\xe8\xda\xad\x83\x8d\x23\x85\x66\xa3\xf8\x81\x00\x6b\x81\xd5\xd0\x18\xc8\x5a\xe4\x90\x92\x3f\x8c\x50\xb4\xc1\x1c\x7e\x86\xbe\xff\x88\x6a\xc1\x68\x8b\xa5\x19\x27\xca\xe2\xc8\x0d\xae\x28\x6f\x10\xd2\x7f\xce\x21\xd5\x21\x03\x7e\x79\x37\xa5\x07\x80\x7c\x64\x6a\xd6\xb2\x75\x9b\x52\x31\x6e\x6a\x48\xaa\x50\xb1\x38\xd3\xc5\xd8\x52\xc1\xaa\x64\xaa\xb4\xcd\xbd\x80\x2f\x23\x76\xa1\x8c\x03\xee\x3c\x74\xe0\xda\xf1\xa7\xe4\x71\x80\x79\xd6\x92\x90\xee\x40\x21\xb5\xc7\x08\x06\xb2\x52\xaa\x1a\xb7\x9e\xb8\xc3\xb6\x93\xa7\x42\x92\xbf\xa8\x62\xb4\x62\x65\x58\xf4\x61\x3e\x4a\x0f\x61\x03\x97\xbe\x86\xa7\x60\x36\xcd\x72\x71\xa6\x13\x5f\x65\x00\x34\x8e\x8a\x02\xc6\xc8\xbe\x07\x2a\x65\xcb\x50\x3b\x3a\xfd\xfa\x14\x3a\x51\x32\xd0\x1d\xf4\x80\x6d\x45\xe2\xc8\xa7\xcf\xea\x64\xdb\xd6\x1c\xa9\xfb\x5a\x27\x84\x8c\xbd\x9e\xa0\x8e\xef\x2f\x8f\x13\xf4\x11\xed\xb9\x6e\x97\xaa\x49\xc2\xa4\xc9\xb5\xf4\xd0\x8e\xd1\xa7\xe8\xa9\x10\x52\xef\x68\x6a\xbf\xaa\xc8\xa0\xaa\x87\xba\x7a\xf4\x95\xc7\xd1\xe3\x8b\x3d\x1b\xb2\x0e\xe3\xfd\xea\xc8\xd3\xbb\x62\xa1\xba\xa4\x2d\xa4\xf5\x37\x45\x82\x9f\x37\xb4\x65\xe6\x2b\x94\x2b\x2c\xef\x76\x05\x62\x2d\x7c\xde\x08\xd7\xf9\x58\x6b\x50\x0c\x2c\xcd\x4f\x7a\x70\x0b\x77\x98\x11\xf3\x03\xde\xff\xb6\x4f\x52\x5d\xf8\x7a\x95\x32\xf1\x50\x27\x0e\xf9\xd3\xd5\x51\x0f\xb9\xff\xa7\x38\x76\xec\x2a\xf3\x7e\x55\xe7\x3b\x76\xd5\x1d\xe3\x56\xdd\x37\xcd\x0a\xb2\x87\x32\xcc\x21\xdb\x7a\x51\xfe\x5c\xdf\x3a\x2c\xcb\xfd\x46\xc6\x6a\xe0\xc2\x84\x9a\xac\x7d\x34\xcd\xb1\x06\x37\xea\x76\x5c\x7d\x52\xc0\x8e\xdc\xdd\xa2\x8e\xca\xce\x61\xb4\xa6\x77\x98\xdd\xdc\x32\x6e\x50\xd5\xb4\x44\xdb\x9f\x43\x8b\x7c\x66\xbb\x79\xee\x82\x6b\xa1\x80\xb9\x84\x40\x60\xe7\x6b\x47\x51\x77\xc3\x6e\xe1\x1d\x4c\xd1\x37\xec\xd6\x6d\xf4\xc3\xc9\x5b\x5a\x7e\xb8\x7b\x34\xb3\xdb\xe9\x4a\x3d\xc3\x79\x3d\xed\x2f\x62\xbe\xd1\xa4\xee\x83\x57\x6d\x98\xfb\x7d\xd5\xe0\x61\x1b\xc6\x00\xf7\xbf\xe3\x20\x1f\xa8\x3e\xf3\xf7\xe7\xc9\x4b\xf0\x81\x6a\x57\xf7\x29\xf5\xe3\xa8\x38\xac\x1a\xdc\x27\xfe\x57\xe5\xb1\x6e\xdc\xc4\x81\x7a\xba\x0c\xdc\xfc\xc5\x8a\xbe\x8c\x0a\x02\x9a\x53\x07\x67\xfa\x6f\x66\x56\xc9\x88\xf2\xf7\xa5\x31\xa0\x42\xa1\x61\x1d\x72\x28\x05\xaf\x98\x61\x82\x6b\xc8\x84\x59\xa1\x9a\x0a\xe9\x7c\x1f\xe3\x6e\x5b\x03\x21\xe4\x21\xad\xe8\xdd\x6b\x7b\xd0\x5b\x93\xc5\x7d\xe0\xeb\xc5\xfe\x01\x17\x05\x5c\xf2\x0a\x1a\x25\x36\x52\x43\xcb\xb4\x01\x51\xcf\x98\x0a\x23\x39\xd6\x2f\xaf\x16\x20\x24\x2a\x6a\x84\x82\x4f\x68\xee\x11\xbd\x1c\xd6\xc3\x73\xeb\x92\x57\xd9\x2c\x6f\x87\xc7\x63\x18\x7c\x0d\x2f\x30\xca\x8f\x7b\x82\x91\x43\x4f\xb0\xa2\x80\x6b\x75\x0c\xe2\xd7\xbf\x3f\x09\xf8\xb5\x7a\x13\x78\x0b\xf5\x6c\xb8\xaf\x84\x79\xe0\x6c\xee\x27\xd5\x88\xec\x60\x6a\xc1\xb4\x26\x24\x02\xc6\x57\xc2\x64\xf2\x00\x3e\xaf\x1d\x58\x2e\xcc\xf3\x90\x9d\x6c\xe4\xbf\x00\x00\x00\xff\xff\x94\x69\xf5\x25\x23\x12\x00\x00") func templateWhereTmplBytes() ([]byte, error) { return bindataRead( @@ -879,7 +879,7 @@ func templateWhereTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/where.tmpl", size: 4610, mode: os.FileMode(420), modTime: time.Unix(1565164297, 0)} + info := bindataFileInfo{name: "template/where.tmpl", size: 4643, mode: os.FileMode(420), modTime: time.Unix(1565167395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/func.go b/entc/gen/func.go index 09de70d84..eac0a14d9 100644 --- a/entc/gen/func.go +++ b/entc/gen/func.go @@ -45,16 +45,20 @@ var ( } ) -// ops returns all operations for given type. -func ops(f *Field) []Op { +// ops returns all operations for given field. +func ops(f *Field) (op []Op) { switch t := f.Type; { case t == field.TypeBool: - return boolOps + op = boolOps case t == field.TypeString && strings.ToLower(f.Name) != "id": - return stringOps + op = stringOps default: - return numericOps + op = numericOps } + if f.Nullable || f.Optional { + op = append(op, nillableOps...) + } + return op } // xrange generates a slice of len n. diff --git a/entc/gen/predicate.go b/entc/gen/predicate.go index 4f2101ff6..88849e832 100644 --- a/entc/gen/predicate.go +++ b/entc/gen/predicate.go @@ -11,6 +11,8 @@ const ( GTE // >= LT // < LTE // <= + IsNull // IS NULL / has + NotNull // IS NOT NULL / hasNot In // within NotIn // without Contains // containing @@ -39,6 +41,11 @@ func (o Op) Variadic() bool { return o == In || o == NotIn } +// Niladic reports if the predicate is a niladic predicate. +func (o Op) Niladic() bool { + return o == IsNull || o == NotNull +} + var ( // operations text. opText = [...]string{ @@ -48,6 +55,8 @@ var ( GTE: "GTE", LT: "LT", LTE: "LTE", + IsNull: "IsNull", + NotNull: "NotNull", Contains: "Contains", HasPrefix: "HasPrefix", HasSuffix: "HasSuffix", @@ -56,6 +65,8 @@ var ( } // operations code in gremlin. gremlinCode = [...]string{ + IsNull: "HasNot", + NotNull: "Has", In: "Within", NotIn: "Without", Contains: "Containing", @@ -63,7 +74,8 @@ var ( HasSuffix: "EndingWith", } // operations per type. - boolOps = []Op{EQ, NEQ} - numericOps = append(boolOps[:], GT, GTE, LT, LTE, In, NotIn) - stringOps = append(numericOps[:], Contains, HasPrefix, HasSuffix) + boolOps = []Op{EQ, NEQ} + numericOps = append(boolOps[:], GT, GTE, LT, LTE, In, NotIn) + stringOps = append(numericOps[:], Contains, HasPrefix, HasSuffix) + nillableOps = []Op{IsNull, NotNull} ) diff --git a/entc/gen/template/dialect/gremlin/predicate.tmpl b/entc/gen/template/dialect/gremlin/predicate.tmpl index 81adb4c52..f3cc7d183 100644 --- a/entc/gen/template/dialect/gremlin/predicate.tmpl +++ b/entc/gen/template/dialect/gremlin/predicate.tmpl @@ -29,7 +29,11 @@ {{- $f := $.Scope.Field -}} {{- $op := $.Scope.Op -}} func(t *dsl.Traversal) { + {{- if not $op.Niladic }} t.Has(Label, {{ $f.Constant }}, p.{{ $op.Gremlin }}(v{{ if $op.Variadic }}...{{ end }})) + {{- else }} + t.HasLabel(Label).{{ $op.Gremlin }}({{ $f.Constant }}) + {{- end }} } {{- end }} diff --git a/entc/gen/template/dialect/sql/predicate.tmpl b/entc/gen/template/dialect/sql/predicate.tmpl index 400978228..b9a89ade8 100644 --- a/entc/gen/template/dialect/sql/predicate.tmpl +++ b/entc/gen/template/dialect/sql/predicate.tmpl @@ -47,7 +47,7 @@ return } {{- end }} - s.Where(sql.{{ $op.Name }}(s.C({{ $f.Constant }}), v{{ if $op.Variadic }}...{{ end }})) + s.Where(sql.{{ $op.Name }}(s.C({{ $f.Constant }}){{ if not $op.Niladic }}, v{{ if $op.Variadic }}...{{ end }}{{ end }})) } {{- end }} diff --git a/entc/gen/template/dialect/sql/update.tmpl b/entc/gen/template/dialect/sql/update.tmpl index 9d5300314..e6c4acaf9 100644 --- a/entc/gen/template/dialect/sql/update.tmpl +++ b/entc/gen/template/dialect/sql/update.tmpl @@ -65,7 +65,11 @@ func ({{ $receiver }} *{{ $builder }}) sqlSave(ctx context.Context) ({{ $ret }} update = true builder.Set({{ $.Package }}.{{ $f.Constant }}, *{{ $receiver }}.{{ $f.StructField }}) {{- if $one }} - {{ if $f.Nullable }}*{{ end }}{{ $.Receiver }}.{{ pascal $f.Name }} = *{{ $receiver }}.{{ $f.StructField }} + {{- if $f.Nullable }} + {{ $.Receiver }}.{{ pascal $f.Name }} = {{ $receiver }}.{{ $f.StructField }} + {{- else }} + {{ $.Receiver }}.{{ pascal $f.Name }} = *{{ $receiver }}.{{ $f.StructField }} + {{- end }} {{- end }} } {{- end }} diff --git a/entc/gen/template/where.tmpl b/entc/gen/template/where.tmpl index ba56d4fe7..ccbd3d8c7 100644 --- a/entc/gen/template/where.tmpl +++ b/entc/gen/template/where.tmpl @@ -52,7 +52,7 @@ func ID(id {{ $.ID.Type }}) predicate.{{ $.Name }} { {{ $arg := "v" }}{{ if $op.Variadic }}{{ $arg = "vs" }}{{ end }} {{ $func := print (pascal $f.Name) ($op.Name) }} // {{ $func }} applies the {{ $op.Name }} predicate on the {{ quote $f.Name }} field. - func {{ $func }}({{ $arg }} {{ if $op.Variadic }}...{{ end }}{{ $f.Type }}) predicate.{{ $.Name }} { + func {{ $func }}({{ if not $op.Niladic }}{{ $arg }} {{ if $op.Variadic }}...{{ end }}{{ $f.Type }}{{ end }}) predicate.{{ $.Name }} { {{- if $op.Variadic }} v := make([]interface{}, len({{ $arg }})) for i := range v { diff --git a/entc/integration/ent/example_test.go b/entc/integration/ent/example_test.go index d718db131..0de2f1595 100644 --- a/entc/integration/ent/example_test.go +++ b/entc/integration/ent/example_test.go @@ -119,6 +119,8 @@ func ExampleFile() { Create(). SetSize(1). SetName("string"). + SetUser("string"). + SetGroup("string"). SaveX(ctx) log.Println("file created:", f) @@ -142,6 +144,8 @@ func ExampleGroup() { Create(). SetSize(1). SetName("string"). + SetUser("string"). + SetGroup("string"). SaveX(ctx) log.Println("file created:", f0) u1 := client.User. @@ -306,6 +310,8 @@ func ExampleUser() { Create(). SetSize(1). SetName("string"). + SetUser("string"). + SetGroup("string"). SaveX(ctx) log.Println("file created:", f2) gr3 := client.Group. diff --git a/entc/integration/ent/fieldtype/where.go b/entc/integration/ent/fieldtype/where.go index 08d465378..18aaa2f66 100644 --- a/entc/integration/ent/fieldtype/where.go +++ b/entc/integration/ent/fieldtype/where.go @@ -1032,6 +1032,30 @@ func OptionalIntNotIn(vs ...int) predicate.FieldType { ) } +// OptionalIntIsNull applies the IsNull predicate on the "optional_int" field. +func OptionalIntIsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldOptionalInt))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldOptionalInt) + }, + ) +} + +// OptionalIntNotNull applies the NotNull predicate on the "optional_int" field. +func OptionalIntNotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldOptionalInt))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldOptionalInt) + }, + ) +} + // OptionalInt8EQ applies the EQ predicate on the "optional_int8" field. func OptionalInt8EQ(v int8) predicate.FieldType { return predicate.FieldTypePerDialect( @@ -1148,6 +1172,30 @@ func OptionalInt8NotIn(vs ...int8) predicate.FieldType { ) } +// OptionalInt8IsNull applies the IsNull predicate on the "optional_int8" field. +func OptionalInt8IsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldOptionalInt8))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldOptionalInt8) + }, + ) +} + +// OptionalInt8NotNull applies the NotNull predicate on the "optional_int8" field. +func OptionalInt8NotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldOptionalInt8))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldOptionalInt8) + }, + ) +} + // OptionalInt16EQ applies the EQ predicate on the "optional_int16" field. func OptionalInt16EQ(v int16) predicate.FieldType { return predicate.FieldTypePerDialect( @@ -1264,6 +1312,30 @@ func OptionalInt16NotIn(vs ...int16) predicate.FieldType { ) } +// OptionalInt16IsNull applies the IsNull predicate on the "optional_int16" field. +func OptionalInt16IsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldOptionalInt16))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldOptionalInt16) + }, + ) +} + +// OptionalInt16NotNull applies the NotNull predicate on the "optional_int16" field. +func OptionalInt16NotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldOptionalInt16))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldOptionalInt16) + }, + ) +} + // OptionalInt32EQ applies the EQ predicate on the "optional_int32" field. func OptionalInt32EQ(v int32) predicate.FieldType { return predicate.FieldTypePerDialect( @@ -1380,6 +1452,30 @@ func OptionalInt32NotIn(vs ...int32) predicate.FieldType { ) } +// OptionalInt32IsNull applies the IsNull predicate on the "optional_int32" field. +func OptionalInt32IsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldOptionalInt32))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldOptionalInt32) + }, + ) +} + +// OptionalInt32NotNull applies the NotNull predicate on the "optional_int32" field. +func OptionalInt32NotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldOptionalInt32))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldOptionalInt32) + }, + ) +} + // OptionalInt64EQ applies the EQ predicate on the "optional_int64" field. func OptionalInt64EQ(v int64) predicate.FieldType { return predicate.FieldTypePerDialect( @@ -1496,6 +1592,30 @@ func OptionalInt64NotIn(vs ...int64) predicate.FieldType { ) } +// OptionalInt64IsNull applies the IsNull predicate on the "optional_int64" field. +func OptionalInt64IsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldOptionalInt64))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldOptionalInt64) + }, + ) +} + +// OptionalInt64NotNull applies the NotNull predicate on the "optional_int64" field. +func OptionalInt64NotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldOptionalInt64))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldOptionalInt64) + }, + ) +} + // NullableIntEQ applies the EQ predicate on the "nullable_int" field. func NullableIntEQ(v int) predicate.FieldType { return predicate.FieldTypePerDialect( @@ -1612,6 +1732,30 @@ func NullableIntNotIn(vs ...int) predicate.FieldType { ) } +// NullableIntIsNull applies the IsNull predicate on the "nullable_int" field. +func NullableIntIsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldNullableInt))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldNullableInt) + }, + ) +} + +// NullableIntNotNull applies the NotNull predicate on the "nullable_int" field. +func NullableIntNotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldNullableInt))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldNullableInt) + }, + ) +} + // NullableInt8EQ applies the EQ predicate on the "nullable_int8" field. func NullableInt8EQ(v int8) predicate.FieldType { return predicate.FieldTypePerDialect( @@ -1728,6 +1872,30 @@ func NullableInt8NotIn(vs ...int8) predicate.FieldType { ) } +// NullableInt8IsNull applies the IsNull predicate on the "nullable_int8" field. +func NullableInt8IsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldNullableInt8))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldNullableInt8) + }, + ) +} + +// NullableInt8NotNull applies the NotNull predicate on the "nullable_int8" field. +func NullableInt8NotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldNullableInt8))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldNullableInt8) + }, + ) +} + // NullableInt16EQ applies the EQ predicate on the "nullable_int16" field. func NullableInt16EQ(v int16) predicate.FieldType { return predicate.FieldTypePerDialect( @@ -1844,6 +2012,30 @@ func NullableInt16NotIn(vs ...int16) predicate.FieldType { ) } +// NullableInt16IsNull applies the IsNull predicate on the "nullable_int16" field. +func NullableInt16IsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldNullableInt16))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldNullableInt16) + }, + ) +} + +// NullableInt16NotNull applies the NotNull predicate on the "nullable_int16" field. +func NullableInt16NotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldNullableInt16))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldNullableInt16) + }, + ) +} + // NullableInt32EQ applies the EQ predicate on the "nullable_int32" field. func NullableInt32EQ(v int32) predicate.FieldType { return predicate.FieldTypePerDialect( @@ -1960,6 +2152,30 @@ func NullableInt32NotIn(vs ...int32) predicate.FieldType { ) } +// NullableInt32IsNull applies the IsNull predicate on the "nullable_int32" field. +func NullableInt32IsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldNullableInt32))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldNullableInt32) + }, + ) +} + +// NullableInt32NotNull applies the NotNull predicate on the "nullable_int32" field. +func NullableInt32NotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldNullableInt32))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldNullableInt32) + }, + ) +} + // NullableInt64EQ applies the EQ predicate on the "nullable_int64" field. func NullableInt64EQ(v int64) predicate.FieldType { return predicate.FieldTypePerDialect( @@ -2076,6 +2292,30 @@ func NullableInt64NotIn(vs ...int64) predicate.FieldType { ) } +// NullableInt64IsNull applies the IsNull predicate on the "nullable_int64" field. +func NullableInt64IsNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldNullableInt64))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldNullableInt64) + }, + ) +} + +// NullableInt64NotNull applies the NotNull predicate on the "nullable_int64" field. +func NullableInt64NotNull() predicate.FieldType { + return predicate.FieldTypePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldNullableInt64))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldNullableInt64) + }, + ) +} + // And groups list of predicates with the AND operator between them. func And(predicates ...predicate.FieldType) predicate.FieldType { return predicate.FieldTypePerDialect( diff --git a/entc/integration/ent/fieldtype_update.go b/entc/integration/ent/fieldtype_update.go index c046645f8..c6c628f9c 100644 --- a/entc/integration/ent/fieldtype_update.go +++ b/entc/integration/ent/fieldtype_update.go @@ -735,27 +735,27 @@ func (ftuo *FieldTypeUpdateOne) sqlSave(ctx context.Context) (ft *FieldType, err if ftuo.nullable_int != nil { update = true builder.Set(fieldtype.FieldNullableInt, *ftuo.nullable_int) - *ft.NullableInt = *ftuo.nullable_int + ft.NullableInt = ftuo.nullable_int } if ftuo.nullable_int8 != nil { update = true builder.Set(fieldtype.FieldNullableInt8, *ftuo.nullable_int8) - *ft.NullableInt8 = *ftuo.nullable_int8 + ft.NullableInt8 = ftuo.nullable_int8 } if ftuo.nullable_int16 != nil { update = true builder.Set(fieldtype.FieldNullableInt16, *ftuo.nullable_int16) - *ft.NullableInt16 = *ftuo.nullable_int16 + ft.NullableInt16 = ftuo.nullable_int16 } if ftuo.nullable_int32 != nil { update = true builder.Set(fieldtype.FieldNullableInt32, *ftuo.nullable_int32) - *ft.NullableInt32 = *ftuo.nullable_int32 + ft.NullableInt32 = ftuo.nullable_int32 } if ftuo.nullable_int64 != nil { update = true builder.Set(fieldtype.FieldNullableInt64, *ftuo.nullable_int64) - *ft.NullableInt64 = *ftuo.nullable_int64 + ft.NullableInt64 = ftuo.nullable_int64 } if update { query, args := builder.Query() diff --git a/entc/integration/ent/file.go b/entc/integration/ent/file.go index 8533134aa..ef3ce05d9 100644 --- a/entc/integration/ent/file.go +++ b/entc/integration/ent/file.go @@ -20,26 +20,39 @@ type File struct { Size int `json:"size,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` + // User holds the value of the "user" field. + User *string `json:"user,omitempty"` + // Group holds the value of the "group" field. + Group string `json:"group,omitempty"` } // FromRows scans the sql response data into File. func (f *File) FromRows(rows *sql.Rows) error { var vf struct { - ID int - Size int - Name string + ID int + Size int + Name string + User sql.NullString + Group sql.NullString } // the order here should be the same as in the `file.Columns`. if err := rows.Scan( &vf.ID, &vf.Size, &vf.Name, + &vf.User, + &vf.Group, ); err != nil { return err } f.ID = strconv.Itoa(vf.ID) f.Size = vf.Size f.Name = vf.Name + if vf.User.Valid { + f.User = new(string) + *f.User = vf.User.String + } + f.Group = vf.Group.String return nil } @@ -50,9 +63,11 @@ func (f *File) FromResponse(res *gremlin.Response) error { return err } var vf struct { - ID string `json:"id,omitempty"` - Size int `json:"size,omitempty"` - Name string `json:"name,omitempty"` + ID string `json:"id,omitempty"` + Size int `json:"size,omitempty"` + Name string `json:"name,omitempty"` + User *string `json:"user,omitempty"` + Group string `json:"group,omitempty"` } if err := vmap.Decode(&vf); err != nil { return err @@ -60,6 +75,8 @@ func (f *File) FromResponse(res *gremlin.Response) error { f.ID = vf.ID f.Size = vf.Size f.Name = vf.Name + f.User = vf.User + f.Group = vf.Group return nil } @@ -88,6 +105,10 @@ func (f *File) String() string { buf.WriteString(fmt.Sprintf("id=%v", f.ID)) buf.WriteString(fmt.Sprintf(", size=%v", f.Size)) buf.WriteString(fmt.Sprintf(", name=%v", f.Name)) + if v := f.User; v != nil { + buf.WriteString(fmt.Sprintf(", user=%v", *v)) + } + buf.WriteString(fmt.Sprintf(", group=%v", f.Group)) buf.WriteString(")") return buf.String() } @@ -120,18 +141,22 @@ func (f *Files) FromResponse(res *gremlin.Response) error { return err } var vf []struct { - ID string `json:"id,omitempty"` - Size int `json:"size,omitempty"` - Name string `json:"name,omitempty"` + ID string `json:"id,omitempty"` + Size int `json:"size,omitempty"` + Name string `json:"name,omitempty"` + User *string `json:"user,omitempty"` + Group string `json:"group,omitempty"` } if err := vmap.Decode(&vf); err != nil { return err } for _, v := range vf { *f = append(*f, &File{ - ID: v.ID, - Size: v.Size, - Name: v.Name, + ID: v.ID, + Size: v.Size, + Name: v.Name, + User: v.User, + Group: v.Group, }) } return nil diff --git a/entc/integration/ent/file/file.go b/entc/integration/ent/file/file.go index 89ec88473..6fe43b841 100644 --- a/entc/integration/ent/file/file.go +++ b/entc/integration/ent/file/file.go @@ -15,6 +15,10 @@ const ( FieldSize = "size" // FieldName holds the string denoting the name vertex property in the database. FieldName = "name" + // FieldUser holds the string denoting the user vertex property in the database. + FieldUser = "user" + // FieldGroup holds the string denoting the group vertex property in the database. + FieldGroup = "group" // Table holds the table name of the file in the database. Table = "files" @@ -25,6 +29,8 @@ var Columns = []string{ FieldID, FieldSize, FieldName, + FieldUser, + FieldGroup, } var ( diff --git a/entc/integration/ent/file/where.go b/entc/integration/ent/file/where.go index bc40d6bff..5e6a17c9d 100644 --- a/entc/integration/ent/file/where.go +++ b/entc/integration/ent/file/where.go @@ -180,6 +180,30 @@ func Name(v string) predicate.File { ) } +// User applies equality check predicate on the "user" field. It's identical to UserEQ. +func User(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.EQ(v)) + }, + ) +} + +// Group applies equality check predicate on the "group" field. It's identical to GroupEQ. +func Group(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.EQ(v)) + }, + ) +} + // SizeEQ applies the EQ predicate on the "size" field. func SizeEQ(v int) predicate.File { return predicate.FilePerDialect( @@ -448,6 +472,358 @@ func NameHasSuffix(v string) predicate.File { ) } +// UserEQ applies the EQ predicate on the "user" field. +func UserEQ(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.EQ(v)) + }, + ) +} + +// UserNEQ applies the NEQ predicate on the "user" field. +func UserNEQ(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.NEQ(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.NEQ(v)) + }, + ) +} + +// UserGT applies the GT predicate on the "user" field. +func UserGT(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.GT(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.GT(v)) + }, + ) +} + +// UserGTE applies the GTE predicate on the "user" field. +func UserGTE(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.GTE(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.GTE(v)) + }, + ) +} + +// UserLT applies the LT predicate on the "user" field. +func UserLT(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.LT(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.LT(v)) + }, + ) +} + +// UserLTE applies the LTE predicate on the "user" field. +func UserLTE(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.LTE(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.LTE(v)) + }, + ) +} + +// UserIn applies the In predicate on the "user" field. +func UserIn(vs ...string) predicate.File { + v := make([]interface{}, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.FilePerDialect( + func(s *sql.Selector) { + // if not arguments were provided, append the FALSE constants, + // since we can't apply "IN ()". This will make this predicate falsy. + if len(vs) == 0 { + s.Where(sql.False()) + return + } + s.Where(sql.In(s.C(FieldUser), v...)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.Within(v...)) + }, + ) +} + +// UserNotIn applies the NotIn predicate on the "user" field. +func UserNotIn(vs ...string) predicate.File { + v := make([]interface{}, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.FilePerDialect( + func(s *sql.Selector) { + // if not arguments were provided, append the FALSE constants, + // since we can't apply "IN ()". This will make this predicate falsy. + if len(vs) == 0 { + s.Where(sql.False()) + return + } + s.Where(sql.NotIn(s.C(FieldUser), v...)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.Without(v...)) + }, + ) +} + +// UserContains applies the Contains predicate on the "user" field. +func UserContains(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.Contains(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.Containing(v)) + }, + ) +} + +// UserHasPrefix applies the HasPrefix predicate on the "user" field. +func UserHasPrefix(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.HasPrefix(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.StartingWith(v)) + }, + ) +} + +// UserHasSuffix applies the HasSuffix predicate on the "user" field. +func UserHasSuffix(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.HasSuffix(s.C(FieldUser), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldUser, p.EndingWith(v)) + }, + ) +} + +// UserIsNull applies the IsNull predicate on the "user" field. +func UserIsNull() predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldUser))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldUser) + }, + ) +} + +// UserNotNull applies the NotNull predicate on the "user" field. +func UserNotNull() predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldUser))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldUser) + }, + ) +} + +// GroupEQ applies the EQ predicate on the "group" field. +func GroupEQ(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.EQ(v)) + }, + ) +} + +// GroupNEQ applies the NEQ predicate on the "group" field. +func GroupNEQ(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.NEQ(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.NEQ(v)) + }, + ) +} + +// GroupGT applies the GT predicate on the "group" field. +func GroupGT(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.GT(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.GT(v)) + }, + ) +} + +// GroupGTE applies the GTE predicate on the "group" field. +func GroupGTE(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.GTE(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.GTE(v)) + }, + ) +} + +// GroupLT applies the LT predicate on the "group" field. +func GroupLT(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.LT(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.LT(v)) + }, + ) +} + +// GroupLTE applies the LTE predicate on the "group" field. +func GroupLTE(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.LTE(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.LTE(v)) + }, + ) +} + +// GroupIn applies the In predicate on the "group" field. +func GroupIn(vs ...string) predicate.File { + v := make([]interface{}, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.FilePerDialect( + func(s *sql.Selector) { + // if not arguments were provided, append the FALSE constants, + // since we can't apply "IN ()". This will make this predicate falsy. + if len(vs) == 0 { + s.Where(sql.False()) + return + } + s.Where(sql.In(s.C(FieldGroup), v...)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.Within(v...)) + }, + ) +} + +// GroupNotIn applies the NotIn predicate on the "group" field. +func GroupNotIn(vs ...string) predicate.File { + v := make([]interface{}, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.FilePerDialect( + func(s *sql.Selector) { + // if not arguments were provided, append the FALSE constants, + // since we can't apply "IN ()". This will make this predicate falsy. + if len(vs) == 0 { + s.Where(sql.False()) + return + } + s.Where(sql.NotIn(s.C(FieldGroup), v...)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.Without(v...)) + }, + ) +} + +// GroupContains applies the Contains predicate on the "group" field. +func GroupContains(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.Contains(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.Containing(v)) + }, + ) +} + +// GroupHasPrefix applies the HasPrefix predicate on the "group" field. +func GroupHasPrefix(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.HasPrefix(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.StartingWith(v)) + }, + ) +} + +// GroupHasSuffix applies the HasSuffix predicate on the "group" field. +func GroupHasSuffix(v string) predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.HasSuffix(s.C(FieldGroup), v)) + }, + func(t *dsl.Traversal) { + t.Has(Label, FieldGroup, p.EndingWith(v)) + }, + ) +} + +// GroupIsNull applies the IsNull predicate on the "group" field. +func GroupIsNull() predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldGroup))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldGroup) + }, + ) +} + +// GroupNotNull applies the NotNull predicate on the "group" field. +func GroupNotNull() predicate.File { + return predicate.FilePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldGroup))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldGroup) + }, + ) +} + // And groups list of predicates with the AND operator between them. func And(predicates ...predicate.File) predicate.File { return predicate.FilePerDialect( diff --git a/entc/integration/ent/file_create.go b/entc/integration/ent/file_create.go index 1dc462541..38044556e 100644 --- a/entc/integration/ent/file_create.go +++ b/entc/integration/ent/file_create.go @@ -20,8 +20,10 @@ import ( // FileCreate is the builder for creating a File entity. type FileCreate struct { config - size *int - name *string + size *int + name *string + user *string + group *string } // SetSize sets the size field. @@ -44,6 +46,34 @@ func (fc *FileCreate) SetName(s string) *FileCreate { return fc } +// SetUser sets the user field. +func (fc *FileCreate) SetUser(s string) *FileCreate { + fc.user = &s + return fc +} + +// SetNillableUser sets the user field if the given value is not nil. +func (fc *FileCreate) SetNillableUser(s *string) *FileCreate { + if s != nil { + fc.SetUser(*s) + } + return fc +} + +// SetGroup sets the group field. +func (fc *FileCreate) SetGroup(s string) *FileCreate { + fc.group = &s + return fc +} + +// SetNillableGroup sets the group field if the given value is not nil. +func (fc *FileCreate) SetNillableGroup(s *string) *FileCreate { + if s != nil { + fc.SetGroup(*s) + } + return fc +} + // Save creates the File in the database. func (fc *FileCreate) Save(ctx context.Context) (*File, error) { if fc.size == nil { @@ -93,6 +123,14 @@ func (fc *FileCreate) sqlSave(ctx context.Context) (*File, error) { builder.Set(file.FieldName, *fc.name) f.Name = *fc.name } + if fc.user != nil { + builder.Set(file.FieldUser, *fc.user) + f.User = fc.user + } + if fc.group != nil { + builder.Set(file.FieldGroup, *fc.group) + f.Group = *fc.group + } query, args := builder.Query() if err := tx.Exec(ctx, query, args, &res); err != nil { return nil, rollback(tx, err) @@ -132,5 +170,11 @@ func (fc *FileCreate) gremlin() *dsl.Traversal { if fc.name != nil { v.Property(dsl.Single, file.FieldName, *fc.name) } + if fc.user != nil { + v.Property(dsl.Single, file.FieldUser, *fc.user) + } + if fc.group != nil { + v.Property(dsl.Single, file.FieldGroup, *fc.group) + } return v.ValueMap(true) } diff --git a/entc/integration/ent/file_update.go b/entc/integration/ent/file_update.go index 33a20a3a2..2a35d7d4f 100644 --- a/entc/integration/ent/file_update.go +++ b/entc/integration/ent/file_update.go @@ -22,6 +22,8 @@ type FileUpdate struct { config size *int name *string + user *string + group *string predicates []predicate.File } @@ -51,6 +53,34 @@ func (fu *FileUpdate) SetName(s string) *FileUpdate { return fu } +// SetUser sets the user field. +func (fu *FileUpdate) SetUser(s string) *FileUpdate { + fu.user = &s + return fu +} + +// SetNillableUser sets the user field if the given value is not nil. +func (fu *FileUpdate) SetNillableUser(s *string) *FileUpdate { + if s != nil { + fu.SetUser(*s) + } + return fu +} + +// SetGroup sets the group field. +func (fu *FileUpdate) SetGroup(s string) *FileUpdate { + fu.group = &s + return fu +} + +// SetNillableGroup sets the group field if the given value is not nil. +func (fu *FileUpdate) SetNillableGroup(s *string) *FileUpdate { + if s != nil { + fu.SetGroup(*s) + } + return fu +} + // Save executes the query and returns the number of rows/vertices matched by this operation. func (fu *FileUpdate) Save(ctx context.Context) (int, error) { if fu.size != nil { @@ -130,6 +160,14 @@ func (fu *FileUpdate) sqlSave(ctx context.Context) (n int, err error) { update = true builder.Set(file.FieldName, *fu.name) } + if fu.user != nil { + update = true + builder.Set(file.FieldUser, *fu.user) + } + if fu.group != nil { + update = true + builder.Set(file.FieldGroup, *fu.group) + } if update { query, args := builder.Query() if err := tx.Exec(ctx, query, args, &res); err != nil { @@ -168,6 +206,12 @@ func (fu *FileUpdate) gremlin() *dsl.Traversal { if fu.name != nil { v.Property(dsl.Single, file.FieldName, *fu.name) } + if fu.user != nil { + v.Property(dsl.Single, file.FieldUser, *fu.user) + } + if fu.group != nil { + v.Property(dsl.Single, file.FieldGroup, *fu.group) + } v.Count() trs = append(trs, v) return dsl.Join(trs...) @@ -176,9 +220,11 @@ func (fu *FileUpdate) gremlin() *dsl.Traversal { // FileUpdateOne is the builder for updating a single File entity. type FileUpdateOne struct { config - id string - size *int - name *string + id string + size *int + name *string + user *string + group *string } // SetSize sets the size field. @@ -201,6 +247,34 @@ func (fuo *FileUpdateOne) SetName(s string) *FileUpdateOne { return fuo } +// SetUser sets the user field. +func (fuo *FileUpdateOne) SetUser(s string) *FileUpdateOne { + fuo.user = &s + return fuo +} + +// SetNillableUser sets the user field if the given value is not nil. +func (fuo *FileUpdateOne) SetNillableUser(s *string) *FileUpdateOne { + if s != nil { + fuo.SetUser(*s) + } + return fuo +} + +// SetGroup sets the group field. +func (fuo *FileUpdateOne) SetGroup(s string) *FileUpdateOne { + fuo.group = &s + return fuo +} + +// SetNillableGroup sets the group field if the given value is not nil. +func (fuo *FileUpdateOne) SetNillableGroup(s *string) *FileUpdateOne { + if s != nil { + fuo.SetGroup(*s) + } + return fuo +} + // Save executes the query and returns the updated entity. func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error) { if fuo.size != nil { @@ -285,6 +359,16 @@ func (fuo *FileUpdateOne) sqlSave(ctx context.Context) (f *File, err error) { builder.Set(file.FieldName, *fuo.name) f.Name = *fuo.name } + if fuo.user != nil { + update = true + builder.Set(file.FieldUser, *fuo.user) + f.User = fuo.user + } + if fuo.group != nil { + update = true + builder.Set(file.FieldGroup, *fuo.group) + f.Group = *fuo.group + } if update { query, args := builder.Query() if err := tx.Exec(ctx, query, args, &res); err != nil { @@ -324,6 +408,12 @@ func (fuo *FileUpdateOne) gremlin(id string) *dsl.Traversal { if fuo.name != nil { v.Property(dsl.Single, file.FieldName, *fuo.name) } + if fuo.user != nil { + v.Property(dsl.Single, file.FieldUser, *fuo.user) + } + if fuo.group != nil { + v.Property(dsl.Single, file.FieldGroup, *fuo.group) + } v.ValueMap(true) trs = append(trs, v) return dsl.Join(trs...) diff --git a/entc/integration/ent/group/where.go b/entc/integration/ent/group/where.go index 307df0fbb..83f5bfcb4 100644 --- a/entc/integration/ent/group/where.go +++ b/entc/integration/ent/group/where.go @@ -509,6 +509,30 @@ func TypeHasSuffix(v string) predicate.Group { ) } +// TypeIsNull applies the IsNull predicate on the "type" field. +func TypeIsNull() predicate.Group { + return predicate.GroupPerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldType))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldType) + }, + ) +} + +// TypeNotNull applies the NotNull predicate on the "type" field. +func TypeNotNull() predicate.Group { + return predicate.GroupPerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldType))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldType) + }, + ) +} + // MaxUsersEQ applies the EQ predicate on the "max_users" field. func MaxUsersEQ(v int) predicate.Group { return predicate.GroupPerDialect( @@ -625,6 +649,30 @@ func MaxUsersNotIn(vs ...int) predicate.Group { ) } +// MaxUsersIsNull applies the IsNull predicate on the "max_users" field. +func MaxUsersIsNull() predicate.Group { + return predicate.GroupPerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldMaxUsers))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldMaxUsers) + }, + ) +} + +// MaxUsersNotNull applies the NotNull predicate on the "max_users" field. +func MaxUsersNotNull() predicate.Group { + return predicate.GroupPerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldMaxUsers))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldMaxUsers) + }, + ) +} + // NameEQ applies the EQ predicate on the "name" field. func NameEQ(v string) predicate.Group { return predicate.GroupPerDialect( diff --git a/entc/integration/ent/group_update.go b/entc/integration/ent/group_update.go index c81be5f2e..09c8e05d9 100644 --- a/entc/integration/ent/group_update.go +++ b/entc/integration/ent/group_update.go @@ -927,7 +927,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { if guo._type != nil { update = true builder.Set(group.FieldType, *guo._type) - *gr.Type = *guo._type + gr.Type = guo._type } if guo.max_users != nil { update = true diff --git a/entc/integration/ent/migrate/schema.go b/entc/integration/ent/migrate/schema.go index ab3652d5f..dc86dac8f 100644 --- a/entc/integration/ent/migrate/schema.go +++ b/entc/integration/ent/migrate/schema.go @@ -72,6 +72,8 @@ var ( {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "size", Type: field.TypeInt}, {Name: "name", Type: field.TypeString}, + {Name: "user", Type: field.TypeString}, + {Name: "group", Type: field.TypeString}, {Name: "group_file_id", Type: field.TypeInt, Nullable: &nullable}, {Name: "user_file_id", Type: field.TypeInt, Nullable: &nullable}, } @@ -83,14 +85,14 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "files_groups_files", - Columns: []*schema.Column{FilesColumns[3]}, + Columns: []*schema.Column{FilesColumns[5]}, RefColumns: []*schema.Column{GroupsColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "files_users_files", - Columns: []*schema.Column{FilesColumns[4]}, + Columns: []*schema.Column{FilesColumns[6]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.SetNull, diff --git a/entc/integration/ent/node/where.go b/entc/integration/ent/node/where.go index 0e7fef6b0..801606966 100644 --- a/entc/integration/ent/node/where.go +++ b/entc/integration/ent/node/where.go @@ -284,6 +284,30 @@ func ValueNotIn(vs ...int) predicate.Node { ) } +// ValueIsNull applies the IsNull predicate on the "value" field. +func ValueIsNull() predicate.Node { + return predicate.NodePerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldValue))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldValue) + }, + ) +} + +// ValueNotNull applies the NotNull predicate on the "value" field. +func ValueNotNull() predicate.Node { + return predicate.NodePerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldValue))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldValue) + }, + ) +} + // HasPrev applies the HasEdge predicate on the "prev" edge. func HasPrev() predicate.Node { return predicate.NodePerDialect( diff --git a/entc/integration/ent/schema/file.go b/entc/integration/ent/schema/file.go index 8fb0903a5..4f3c2231c 100644 --- a/entc/integration/ent/schema/file.go +++ b/entc/integration/ent/schema/file.go @@ -19,5 +19,10 @@ func (File) Fields() []ent.Field { Default(math.MaxInt32). Positive(), field.String("name"), + field.String("user"). + Optional(). + Nullable(), + field.String("group"). + Optional(), } } diff --git a/entc/integration/ent/user/where.go b/entc/integration/ent/user/where.go index d7b7d646d..225c1e50e 100644 --- a/entc/integration/ent/user/where.go +++ b/entc/integration/ent/user/where.go @@ -788,6 +788,30 @@ func NicknameHasSuffix(v string) predicate.User { ) } +// NicknameIsNull applies the IsNull predicate on the "nickname" field. +func NicknameIsNull() predicate.User { + return predicate.UserPerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldNickname))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldNickname) + }, + ) +} + +// NicknameNotNull applies the NotNull predicate on the "nickname" field. +func NicknameNotNull() predicate.User { + return predicate.UserPerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldNickname))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldNickname) + }, + ) +} + // PhoneEQ applies the EQ predicate on the "phone" field. func PhoneEQ(v string) predicate.User { return predicate.UserPerDialect( @@ -940,6 +964,30 @@ func PhoneHasSuffix(v string) predicate.User { ) } +// PhoneIsNull applies the IsNull predicate on the "phone" field. +func PhoneIsNull() predicate.User { + return predicate.UserPerDialect( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldPhone))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).HasNot(FieldPhone) + }, + ) +} + +// PhoneNotNull applies the NotNull predicate on the "phone" field. +func PhoneNotNull() predicate.User { + return predicate.UserPerDialect( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldPhone))) + }, + func(t *dsl.Traversal) { + t.HasLabel(Label).Has(FieldPhone) + }, + ) +} + // HasCard applies the HasEdge predicate on the "card" edge. func HasCard() predicate.User { return predicate.UserPerDialect( diff --git a/entc/integration/integration_test.go b/entc/integration/integration_test.go index a1cc0b86e..c6b433910 100644 --- a/entc/integration/integration_test.go +++ b/entc/integration/integration_test.go @@ -273,6 +273,41 @@ func Predicate(t *testing.T, client *ent.Client) { AllX(ctx) require.Equal(f3.Name, files[0].Name) require.Equal(f4.Name, files[1].Name) + + require.Zero(client.File.Query().Where(file.UserNotNull()).CountX(ctx)) + require.Equal(4, client.File.Query().Where(file.UserIsNull()).CountX(ctx)) + require.Zero(client.File.Query().Where(file.GroupNotNull()).CountX(ctx)) + require.Equal(4, client.File.Query().Where(file.GroupIsNull()).CountX(ctx)) + + f1 = f1.Update().SetUser("a8m").SaveX(ctx) + require.NotNil(f1.User) + require.Equal("a8m", *f1.User) + require.Equal(3, client.File.Query().Where(file.UserIsNull()).CountX(ctx)) + require.Equal(f1.Name, client.File.Query().Where(file.UserNotNull()).OnlyX(ctx).Name) + f5 := client.File.Create().SetName("5").SetSize(40).SetUser("mashraki").SaveX(ctx) + require.NotNil(f5.User) + require.Equal("mashraki", *f5.User) + require.Equal(3, client.File.Query().Where(file.UserIsNull()).CountX(ctx)) + require.Equal(2, client.File.Query().Where(file.UserNotNull()).CountX(ctx)) + + require.Equal(5, client.File.Query().Where(file.GroupIsNull()).CountX(ctx)) + f4 = f4.Update().SetGroup("fbc").SaveX(ctx) + require.Equal(1, client.File.Query().Where(file.GroupNotNull()).CountX(ctx)) + require.Equal(4, client.File.Query().Where(file.GroupIsNull()).CountX(ctx)) + require.Equal( + 5, + client.File.Query(). + Where( + file.Or( + file.GroupIsNull(), + file.And( + file.GroupNotNull(), + file.Name(f4.Name), + ), + ), + ). + CountX(ctx), + ) } func Relation(t *testing.T, client *ent.Client) { diff --git a/entc/integration/migrate/entv1/user/where.go b/entc/integration/migrate/entv1/user/where.go index bf45ddbf7..e11a08e53 100644 --- a/entc/integration/migrate/entv1/user/where.go +++ b/entc/integration/migrate/entv1/user/where.go @@ -466,6 +466,24 @@ func AddressHasSuffix(v string) predicate.User { ) } +// AddressIsNull applies the IsNull predicate on the "address" field. +func AddressIsNull() predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldAddress))) + }, + ) +} + +// AddressNotNull applies the NotNull predicate on the "address" field. +func AddressNotNull() predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldAddress))) + }, + ) +} + // And groups list of predicates with the AND operator between them. func And(predicates ...predicate.User) predicate.User { return predicate.User(