From 373769dfaf19d8ba3121651277a5fad0db7396b1 Mon Sep 17 00:00:00 2001 From: Alex Snast Date: Tue, 27 Aug 2019 10:47:29 -0700 Subject: [PATCH] ent/gen: adding EqualFold predicate for string fields Summary: Similar to `ContainsFold` predicate requires `--storage=sql` argument to be passed to entc. Reviewed By: a8m Differential Revision: D17074805 fbshipit-source-id: ced299154417fe2c9007cd6a7a504f53c8b2ef98 --- dialect/sql/builder.go | 8 ++ dialect/sql/builder_test.go | 14 +++ entc/gen/bindata.go | 93 +++++++++++-------- entc/gen/predicate.go | 2 + entc/gen/storage.go | 2 +- entc/integration/migrate/entv1/user/where.go | 18 ++++ entc/integration/migrate/entv2/user/where.go | 27 ++++++ entc/integration/migrate/migrate_test.go | 10 ++ entc/load/bindata.go | 19 +++- examples/m2m2types/ent/client.go | 4 - examples/m2m2types/ent/config.go | 4 - examples/m2m2types/ent/context.go | 4 - examples/m2m2types/ent/ent.go | 4 - examples/m2m2types/ent/example_test.go | 4 - examples/m2m2types/ent/group.go | 4 - examples/m2m2types/ent/group/group.go | 4 - examples/m2m2types/ent/group/where.go | 13 ++- examples/m2m2types/ent/group_create.go | 4 - examples/m2m2types/ent/group_delete.go | 4 - examples/m2m2types/ent/group_query.go | 4 - examples/m2m2types/ent/group_update.go | 4 - examples/m2m2types/ent/migrate/migrate.go | 4 - examples/m2m2types/ent/migrate/schema.go | 4 - examples/m2m2types/ent/predicate/predicate.go | 4 - examples/m2m2types/ent/tx.go | 4 - examples/m2m2types/ent/user.go | 4 - examples/m2m2types/ent/user/user.go | 4 - examples/m2m2types/ent/user/where.go | 13 ++- examples/m2m2types/ent/user_create.go | 4 - examples/m2m2types/ent/user_delete.go | 4 - examples/m2m2types/ent/user_query.go | 4 - examples/m2m2types/ent/user_update.go | 4 - examples/m2mbidi/ent/client.go | 4 - examples/m2mbidi/ent/config.go | 4 - examples/m2mbidi/ent/context.go | 4 - examples/m2mbidi/ent/ent.go | 4 - examples/m2mbidi/ent/example_test.go | 4 - examples/m2mbidi/ent/migrate/migrate.go | 4 - examples/m2mbidi/ent/migrate/schema.go | 4 - examples/m2mbidi/ent/predicate/predicate.go | 4 - examples/m2mbidi/ent/tx.go | 4 - examples/m2mbidi/ent/user.go | 4 - examples/m2mbidi/ent/user/user.go | 4 - examples/m2mbidi/ent/user/where.go | 13 ++- examples/m2mbidi/ent/user_create.go | 4 - examples/m2mbidi/ent/user_delete.go | 4 - examples/m2mbidi/ent/user_query.go | 4 - examples/m2mbidi/ent/user_update.go | 4 - examples/m2mrecur/ent/client.go | 4 - examples/m2mrecur/ent/config.go | 4 - examples/m2mrecur/ent/context.go | 4 - examples/m2mrecur/ent/ent.go | 4 - examples/m2mrecur/ent/example_test.go | 4 - examples/m2mrecur/ent/migrate/migrate.go | 4 - examples/m2mrecur/ent/migrate/schema.go | 4 - examples/m2mrecur/ent/predicate/predicate.go | 4 - examples/m2mrecur/ent/tx.go | 4 - examples/m2mrecur/ent/user.go | 4 - examples/m2mrecur/ent/user/user.go | 4 - examples/m2mrecur/ent/user/where.go | 13 ++- examples/m2mrecur/ent/user_create.go | 4 - examples/m2mrecur/ent/user_delete.go | 4 - examples/m2mrecur/ent/user_query.go | 4 - examples/m2mrecur/ent/user_update.go | 4 - examples/o2m2types/ent/client.go | 4 - examples/o2m2types/ent/config.go | 4 - examples/o2m2types/ent/context.go | 4 - examples/o2m2types/ent/ent.go | 4 - examples/o2m2types/ent/example_test.go | 4 - examples/o2m2types/ent/migrate/migrate.go | 4 - examples/o2m2types/ent/migrate/schema.go | 4 - examples/o2m2types/ent/pet.go | 4 - examples/o2m2types/ent/pet/pet.go | 4 - examples/o2m2types/ent/pet/where.go | 13 ++- examples/o2m2types/ent/pet_create.go | 4 - examples/o2m2types/ent/pet_delete.go | 4 - examples/o2m2types/ent/pet_query.go | 4 - examples/o2m2types/ent/pet_update.go | 4 - examples/o2m2types/ent/predicate/predicate.go | 4 - examples/o2m2types/ent/tx.go | 4 - examples/o2m2types/ent/user.go | 4 - examples/o2m2types/ent/user/user.go | 4 - examples/o2m2types/ent/user/where.go | 13 ++- examples/o2m2types/ent/user_create.go | 4 - examples/o2m2types/ent/user_delete.go | 4 - examples/o2m2types/ent/user_query.go | 4 - examples/o2m2types/ent/user_update.go | 4 - examples/o2mrecur/ent/client.go | 4 - examples/o2mrecur/ent/config.go | 4 - examples/o2mrecur/ent/context.go | 4 - examples/o2mrecur/ent/ent.go | 4 - examples/o2mrecur/ent/example_test.go | 4 - examples/o2mrecur/ent/migrate/migrate.go | 4 - examples/o2mrecur/ent/migrate/schema.go | 4 - examples/o2mrecur/ent/node.go | 4 - examples/o2mrecur/ent/node/node.go | 4 - examples/o2mrecur/ent/node/where.go | 4 - examples/o2mrecur/ent/node_create.go | 4 - examples/o2mrecur/ent/node_delete.go | 4 - examples/o2mrecur/ent/node_query.go | 4 - examples/o2mrecur/ent/node_update.go | 4 - examples/o2mrecur/ent/predicate/predicate.go | 4 - examples/o2mrecur/ent/tx.go | 4 - examples/o2o2types/ent/card.go | 4 - examples/o2o2types/ent/card/card.go | 4 - examples/o2o2types/ent/card/where.go | 13 ++- examples/o2o2types/ent/card_create.go | 4 - examples/o2o2types/ent/card_delete.go | 4 - examples/o2o2types/ent/card_query.go | 4 - examples/o2o2types/ent/card_update.go | 4 - examples/o2o2types/ent/client.go | 4 - examples/o2o2types/ent/config.go | 4 - examples/o2o2types/ent/context.go | 4 - examples/o2o2types/ent/ent.go | 4 - examples/o2o2types/ent/example_test.go | 4 - examples/o2o2types/ent/migrate/migrate.go | 4 - examples/o2o2types/ent/migrate/schema.go | 4 - examples/o2o2types/ent/predicate/predicate.go | 4 - examples/o2o2types/ent/tx.go | 4 - examples/o2o2types/ent/user.go | 4 - examples/o2o2types/ent/user/user.go | 4 - examples/o2o2types/ent/user/where.go | 13 ++- examples/o2o2types/ent/user_create.go | 4 - examples/o2o2types/ent/user_delete.go | 4 - examples/o2o2types/ent/user_query.go | 4 - examples/o2o2types/ent/user_update.go | 4 - examples/o2obidi/ent/client.go | 4 - examples/o2obidi/ent/config.go | 4 - examples/o2obidi/ent/context.go | 4 - examples/o2obidi/ent/ent.go | 4 - examples/o2obidi/ent/example_test.go | 4 - examples/o2obidi/ent/migrate/migrate.go | 4 - examples/o2obidi/ent/migrate/schema.go | 4 - examples/o2obidi/ent/predicate/predicate.go | 4 - examples/o2obidi/ent/tx.go | 4 - examples/o2obidi/ent/user.go | 4 - examples/o2obidi/ent/user/user.go | 4 - examples/o2obidi/ent/user/where.go | 13 ++- examples/o2obidi/ent/user_create.go | 4 - examples/o2obidi/ent/user_delete.go | 4 - examples/o2obidi/ent/user_query.go | 4 - examples/o2obidi/ent/user_update.go | 4 - examples/o2orecur/ent/client.go | 4 - examples/o2orecur/ent/config.go | 4 - examples/o2orecur/ent/context.go | 4 - examples/o2orecur/ent/ent.go | 4 - examples/o2orecur/ent/example_test.go | 4 - examples/o2orecur/ent/migrate/migrate.go | 4 - examples/o2orecur/ent/migrate/schema.go | 4 - examples/o2orecur/ent/node.go | 4 - examples/o2orecur/ent/node/node.go | 4 - examples/o2orecur/ent/node/where.go | 4 - examples/o2orecur/ent/node_create.go | 4 - examples/o2orecur/ent/node_delete.go | 4 - examples/o2orecur/ent/node_query.go | 4 - examples/o2orecur/ent/node_update.go | 4 - examples/o2orecur/ent/predicate/predicate.go | 4 - examples/o2orecur/ent/tx.go | 4 - schema/field/gen/numeric.tmpl | 4 + 159 files changed, 232 insertions(+), 642 deletions(-) diff --git a/dialect/sql/builder.go b/dialect/sql/builder.go index 548ae0b2f..6e6e58231 100644 --- a/dialect/sql/builder.go +++ b/dialect/sql/builder.go @@ -1024,6 +1024,14 @@ func (p *Predicate) HasSuffix(col, suffix string) *Predicate { return p.Like(col, "%"+suffix) } +// EqualFold is a helper predicate that applies the "=" predicate with case-folding. +func EqualFold(col, sub string) *Predicate { return (&Predicate{}).EqualFold(col, sub) } + +// EqualFold is a helper predicate that applies the "=" predicate with case-folding. +func (p *Predicate) EqualFold(col, sub string) *Predicate { + return p.EQ(Lower(col), strings.ToLower(sub)) +} + // Contains is a helper predicate that checks substring using the LIKE predicate. func Contains(col, sub string) *Predicate { return (&Predicate{}).Contains(col, sub) } diff --git a/dialect/sql/builder_test.go b/dialect/sql/builder_test.go index e54c18dfc..2fdaf71c5 100644 --- a/dialect/sql/builder_test.go +++ b/dialect/sql/builder_test.go @@ -188,6 +188,20 @@ func TestBuilder(t *testing.T) { wantQuery: "UPDATE `users` SET `name` = ? WHERE `nickname` LIKE ? AND `lastname` LIKE ?", wantArgs: []interface{}{"foo", "a8m%", "%mash%"}, }, + { + input: Select(). + From(Table("users")). + Where(EqualFold("name", "Alex")), + wantQuery: "SELECT * FROM `users` WHERE LOWER(`name`) = ?", + wantArgs: []interface{}{"alex"}, + }, + { + input: Select(). + From(Table("users")). + Where(EqualFold("name", "BAR").Or().EqualFold("name", "BAZ")), + wantQuery: "SELECT * FROM `users` WHERE LOWER(`name`) = ? OR LOWER(`name`) = ?", + wantArgs: []interface{}{"bar", "baz"}, + }, { input: Select(). From(Table("users")). diff --git a/entc/gen/bindata.go b/entc/gen/bindata.go index ab698ee42..8db59091b 100644 --- a/entc/gen/bindata.go +++ b/entc/gen/bindata.go @@ -1,4 +1,4 @@ -// Code generated by go-bindata. (@generated) DO NOT EDIT. +// Package gen Code generated by go-bindata. (@generated) DO NOT EDIT. // sources: // template/base.tmpl // template/builder/create.tmpl @@ -85,21 +85,32 @@ type bindataFileInfo struct { modTime time.Time } +// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } + +// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } + +// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } + +// Mode return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } + +// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - return false + return fi.mode&os.ModeDir != 0 } + +// Sys return file is sys mode func (fi bindataFileInfo) Sys() interface{} { return nil } @@ -119,7 +130,7 @@ func templateBaseTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/base.tmpl", size: 5021, mode: os.FileMode(420), modTime: time.Unix(1564913315, 0)} + info := bindataFileInfo{name: "template/base.tmpl", size: 5021, mode: os.FileMode(420), modTime: time.Unix(1565007749, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -139,7 +150,7 @@ func templateBuilderCreateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/builder/create.tmpl", size: 2845, mode: os.FileMode(420), modTime: time.Unix(1566906916, 0)} + info := bindataFileInfo{name: "template/builder/create.tmpl", size: 2845, mode: os.FileMode(420), modTime: time.Unix(1566925536, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -159,7 +170,7 @@ func templateBuilderDeleteTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/builder/delete.tmpl", size: 2044, mode: os.FileMode(420), modTime: time.Unix(1565106398, 0)} + info := bindataFileInfo{name: "template/builder/delete.tmpl", size: 2044, mode: os.FileMode(420), modTime: time.Unix(1565162769, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -179,7 +190,7 @@ func templateBuilderQueryTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/builder/query.tmpl", size: 13220, mode: os.FileMode(420), modTime: time.Unix(1565165343, 0)} + info := bindataFileInfo{name: "template/builder/query.tmpl", size: 13220, mode: os.FileMode(420), modTime: time.Unix(1565178244, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -199,7 +210,7 @@ func templateBuilderSetterTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/builder/setter.tmpl", size: 3256, mode: os.FileMode(420), modTime: time.Unix(1566906796, 0)} + info := bindataFileInfo{name: "template/builder/setter.tmpl", size: 3256, mode: os.FileMode(420), modTime: time.Unix(1566925536, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -219,7 +230,7 @@ func templateBuilderUpdateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/builder/update.tmpl", size: 7651, mode: os.FileMode(420), modTime: time.Unix(1566908308, 0)} + info := bindataFileInfo{name: "template/builder/update.tmpl", size: 7651, mode: os.FileMode(420), modTime: time.Unix(1566925536, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -239,7 +250,7 @@ func templateClientTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/client.tmpl", size: 4352, mode: os.FileMode(420), modTime: time.Unix(1566224088, 0)} + info := bindataFileInfo{name: "template/client.tmpl", size: 4352, mode: os.FileMode(420), modTime: time.Unix(1566238093, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -259,7 +270,7 @@ func templateConfigTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/config.tmpl", size: 1077, mode: os.FileMode(420), modTime: time.Unix(1564913322, 0)} + info := bindataFileInfo{name: "template/config.tmpl", size: 1077, mode: os.FileMode(420), modTime: time.Unix(1565007749, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -279,7 +290,7 @@ func templateContextTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/context.tmpl", size: 523, mode: os.FileMode(420), modTime: time.Unix(1564913326, 0)} + info := bindataFileInfo{name: "template/context.tmpl", size: 523, mode: os.FileMode(420), modTime: time.Unix(1565007749, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -299,7 +310,7 @@ func templateDialectGremlinByTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/by.tmpl", size: 1679, mode: os.FileMode(420), modTime: time.Unix(1564480239, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/by.tmpl", size: 1679, mode: os.FileMode(420), modTime: time.Unix(1564494654, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -319,7 +330,7 @@ func templateDialectGremlinCreateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/create.tmpl", size: 2567, mode: os.FileMode(420), modTime: time.Unix(1558503319, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/create.tmpl", size: 2567, mode: os.FileMode(420), modTime: time.Unix(1560858191, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -339,7 +350,7 @@ func templateDialectGremlinDecodeTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/decode.tmpl", size: 1924, mode: os.FileMode(420), modTime: time.Unix(1566909848, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/decode.tmpl", size: 1924, mode: os.FileMode(420), modTime: time.Unix(1566925536, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -359,7 +370,7 @@ func templateDialectGremlinDeleteTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/delete.tmpl", size: 541, mode: os.FileMode(420), modTime: time.Unix(1563979564, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/delete.tmpl", size: 541, mode: os.FileMode(420), modTime: time.Unix(1564440681, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -379,7 +390,7 @@ func templateDialectGremlinErrorsTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/errors.tmpl", size: 1608, mode: os.FileMode(420), modTime: time.Unix(1564480239, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/errors.tmpl", size: 1608, mode: os.FileMode(420), modTime: time.Unix(1564494654, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -399,7 +410,7 @@ func templateDialectGremlinGroupTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/group.tmpl", size: 1151, mode: os.FileMode(420), modTime: time.Unix(1558503319, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/group.tmpl", size: 1151, mode: os.FileMode(420), modTime: time.Unix(1560858192, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -419,7 +430,7 @@ func templateDialectGremlinMetaTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/meta.tmpl", size: 508, mode: os.FileMode(420), modTime: time.Unix(1564480239, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/meta.tmpl", size: 508, mode: os.FileMode(420), modTime: time.Unix(1564494654, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -439,7 +450,7 @@ func templateDialectGremlinPredicateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/predicate.tmpl", size: 3117, mode: os.FileMode(420), modTime: time.Unix(1565183614, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/predicate.tmpl", size: 3117, mode: os.FileMode(420), modTime: time.Unix(1565187546, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -459,7 +470,7 @@ func templateDialectGremlinQueryTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/query.tmpl", size: 3733, mode: os.FileMode(420), modTime: time.Unix(1564480239, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/query.tmpl", size: 3733, mode: os.FileMode(420), modTime: time.Unix(1564494654, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -479,7 +490,7 @@ func templateDialectGremlinUpdateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/update.tmpl", size: 4840, mode: os.FileMode(420), modTime: time.Unix(1566912446, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/update.tmpl", size: 4840, mode: os.FileMode(420), modTime: time.Unix(1566925536, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -499,7 +510,7 @@ func templateDialectSqlByTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/by.tmpl", size: 753, mode: os.FileMode(420), modTime: time.Unix(1564480239, 0)} + info := bindataFileInfo{name: "template/dialect/sql/by.tmpl", size: 753, mode: os.FileMode(420), modTime: time.Unix(1564494654, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -519,7 +530,7 @@ func templateDialectSqlCreateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/create.tmpl", size: 6066, mode: os.FileMode(420), modTime: time.Unix(1565180278, 0)} + info := bindataFileInfo{name: "template/dialect/sql/create.tmpl", size: 6066, mode: os.FileMode(420), modTime: time.Unix(1565187546, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -539,7 +550,7 @@ func templateDialectSqlDecodeTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/decode.tmpl", size: 1820, mode: os.FileMode(420), modTime: time.Unix(1566224080, 0)} + info := bindataFileInfo{name: "template/dialect/sql/decode.tmpl", size: 1820, mode: os.FileMode(420), modTime: time.Unix(1566217695, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -559,7 +570,7 @@ func templateDialectSqlDeleteTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/delete.tmpl", size: 489, mode: os.FileMode(420), modTime: time.Unix(1563979564, 0)} + info := bindataFileInfo{name: "template/dialect/sql/delete.tmpl", size: 489, mode: os.FileMode(420), modTime: time.Unix(1564440681, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -579,7 +590,7 @@ func templateDialectSqlErrorsTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/errors.tmpl", size: 771, mode: os.FileMode(420), modTime: time.Unix(1564480239, 0)} + info := bindataFileInfo{name: "template/dialect/sql/errors.tmpl", size: 771, mode: os.FileMode(420), modTime: time.Unix(1564494654, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -599,7 +610,7 @@ func templateDialectSqlGroupTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/group.tmpl", size: 835, mode: os.FileMode(420), modTime: time.Unix(1558503319, 0)} + info := bindataFileInfo{name: "template/dialect/sql/group.tmpl", size: 835, mode: os.FileMode(420), modTime: time.Unix(1560858192, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -619,7 +630,7 @@ func templateDialectSqlMetaTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/meta.tmpl", size: 1586, mode: os.FileMode(420), modTime: time.Unix(1564480239, 0)} + info := bindataFileInfo{name: "template/dialect/sql/meta.tmpl", size: 1586, mode: os.FileMode(420), modTime: time.Unix(1564494654, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -639,7 +650,7 @@ func templateDialectSqlPredicateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/predicate.tmpl", size: 4330, mode: os.FileMode(420), modTime: time.Unix(1565183595, 0)} + info := bindataFileInfo{name: "template/dialect/sql/predicate.tmpl", size: 4330, mode: os.FileMode(420), modTime: time.Unix(1565187546, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -659,7 +670,7 @@ func templateDialectSqlQueryTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/query.tmpl", size: 6186, mode: os.FileMode(420), modTime: time.Unix(1564480239, 0)} + info := bindataFileInfo{name: "template/dialect/sql/query.tmpl", size: 6186, mode: os.FileMode(420), modTime: time.Unix(1564498182, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -679,7 +690,7 @@ func templateDialectSqlUpdateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/update.tmpl", size: 11432, mode: os.FileMode(420), modTime: time.Unix(1566909124, 0)} + info := bindataFileInfo{name: "template/dialect/sql/update.tmpl", size: 11432, mode: os.FileMode(420), modTime: time.Unix(1566925536, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -699,7 +710,7 @@ func templateEntTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/ent.tmpl", size: 3369, mode: os.FileMode(420), modTime: time.Unix(1565180140, 0)} + info := bindataFileInfo{name: "template/ent.tmpl", size: 3369, mode: os.FileMode(420), modTime: time.Unix(1565187546, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -719,7 +730,7 @@ func templateExampleTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/example.tmpl", size: 2229, mode: os.FileMode(420), modTime: time.Unix(1566224088, 0)} + info := bindataFileInfo{name: "template/example.tmpl", size: 2229, mode: os.FileMode(420), modTime: time.Unix(1566238093, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -739,7 +750,7 @@ func templateHeaderTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/header.tmpl", size: 240, mode: os.FileMode(420), modTime: time.Unix(1564913919, 0)} + info := bindataFileInfo{name: "template/header.tmpl", size: 240, mode: os.FileMode(420), modTime: time.Unix(1565007749, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -759,7 +770,7 @@ func templateImportTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/import.tmpl", size: 556, mode: os.FileMode(420), modTime: time.Unix(1566224088, 0)} + info := bindataFileInfo{name: "template/import.tmpl", size: 556, mode: os.FileMode(420), modTime: time.Unix(1566238093, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -779,7 +790,7 @@ func templateMetaTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/meta.tmpl", size: 2628, mode: os.FileMode(420), modTime: time.Unix(1566905894, 0)} + info := bindataFileInfo{name: "template/meta.tmpl", size: 2628, mode: os.FileMode(420), modTime: time.Unix(1566925536, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -799,7 +810,7 @@ func templateMigrateMigrateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/migrate/migrate.tmpl", size: 1738, mode: os.FileMode(420), modTime: time.Unix(1566224088, 0)} + info := bindataFileInfo{name: "template/migrate/migrate.tmpl", size: 1738, mode: os.FileMode(420), modTime: time.Unix(1566238093, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -819,7 +830,7 @@ func templateMigrateSchemaTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/migrate/schema.tmpl", size: 3536, mode: os.FileMode(420), modTime: time.Unix(1566224088, 0)} + info := bindataFileInfo{name: "template/migrate/schema.tmpl", size: 3536, mode: os.FileMode(420), modTime: time.Unix(1566238093, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -839,7 +850,7 @@ func templatePredicateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/predicate.tmpl", size: 1017, mode: os.FileMode(420), modTime: time.Unix(1566224088, 0)} + info := bindataFileInfo{name: "template/predicate.tmpl", size: 1017, mode: os.FileMode(420), modTime: time.Unix(1566238093, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -859,7 +870,7 @@ func templateTxTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/tx.tmpl", size: 3186, mode: os.FileMode(420), modTime: time.Unix(1566224088, 0)} + info := bindataFileInfo{name: "template/tx.tmpl", size: 3186, mode: os.FileMode(420), modTime: time.Unix(1566238093, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -879,7 +890,7 @@ func templateWhereTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/where.tmpl", size: 4903, mode: os.FileMode(420), modTime: time.Unix(1566475502, 0)} + info := bindataFileInfo{name: "template/where.tmpl", size: 4903, mode: os.FileMode(420), modTime: time.Unix(1566480918, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/predicate.go b/entc/gen/predicate.go index 63f05bc21..1569238ad 100644 --- a/entc/gen/predicate.go +++ b/entc/gen/predicate.go @@ -19,6 +19,7 @@ const ( NotNil // IS NOT NULL / hasNot In // within NotIn // without + EqualFold // equals case-insensitive Contains // containing ContainsFold // containing case-insensitive HasPrefix // startingWith @@ -54,6 +55,7 @@ var ( LTE: "LTE", IsNil: "IsNil", NotNil: "NotNil", + EqualFold: "EqualFold", Contains: "Contains", ContainsFold: "ContainsFold", HasPrefix: "HasPrefix", diff --git a/entc/gen/storage.go b/entc/gen/storage.go index 35c06a494..f89c16230 100644 --- a/entc/gen/storage.go +++ b/entc/gen/storage.go @@ -56,7 +56,7 @@ var drivers = []*Storage{ if !f.IsString() { return nil } - return []Op{ContainsFold} + return []Op{EqualFold, ContainsFold} }, OpCode: opCodes(sqlCode[:]), }, diff --git a/entc/integration/migrate/entv1/user/where.go b/entc/integration/migrate/entv1/user/where.go index 2a3892afe..719253a6c 100644 --- a/entc/integration/migrate/entv1/user/where.go +++ b/entc/integration/migrate/entv1/user/where.go @@ -347,6 +347,15 @@ func NameHasSuffix(v string) predicate.User { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.User { return predicate.User( @@ -493,6 +502,15 @@ func AddressNotNil() predicate.User { ) } +// AddressEqualFold applies the EqualFold predicate on the "address" field. +func AddressEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldAddress), v)) + }, + ) +} + // AddressContainsFold applies the ContainsFold predicate on the "address" field. func AddressContainsFold(v string) predicate.User { return predicate.User( diff --git a/entc/integration/migrate/entv2/user/where.go b/entc/integration/migrate/entv2/user/where.go index 5e04c330e..67ca2ed7b 100644 --- a/entc/integration/migrate/entv2/user/where.go +++ b/entc/integration/migrate/entv2/user/where.go @@ -365,6 +365,15 @@ func NameHasSuffix(v string) predicate.User { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.User { return predicate.User( @@ -493,6 +502,15 @@ func PhoneHasSuffix(v string) predicate.User { ) } +// PhoneEqualFold applies the EqualFold predicate on the "phone" field. +func PhoneEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldPhone), v)) + }, + ) +} + // PhoneContainsFold applies the ContainsFold predicate on the "phone" field. func PhoneContainsFold(v string) predicate.User { return predicate.User( @@ -713,6 +731,15 @@ func TitleHasSuffix(v string) predicate.User { ) } +// TitleEqualFold applies the EqualFold predicate on the "title" field. +func TitleEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldTitle), v)) + }, + ) +} + // TitleContainsFold applies the ContainsFold predicate on the "title" field. func TitleContainsFold(v string) predicate.User { return predicate.User( diff --git a/entc/integration/migrate/migrate_test.go b/entc/integration/migrate/migrate_test.go index 58d0d0976..ddc94cf37 100644 --- a/entc/integration/migrate/migrate_test.go +++ b/entc/integration/migrate/migrate_test.go @@ -52,6 +52,7 @@ func TestMySQL(t *testing.T) { idRange(t, clientv2.Pet.Create().SaveX(ctx).ID, 2<<32-1, 3<<32) // sql specific predicates. + EqualFold(t, clientv2) ContainsFold(t, clientv2) }) } @@ -75,6 +76,7 @@ func TestSQLite(t *testing.T) { // https://www.sqlite.org/pragma.html#pragma_case_sensitive_like _, err = drv.ExecContext(ctx, "PRAGMA case_sensitive_like=1") require.NoError(t, err) + EqualFold(t, client) ContainsFold(t, client) } @@ -118,6 +120,14 @@ func SanityV2(t *testing.T, client *entv2.Client) { ) } +func EqualFold(t *testing.T, client *entv2.Client) { + ctx := context.Background() + t.Log("testing equal-fold on sql specific dialects") + client.User.Create().SetAge(37).SetName("Alex").SetPhone("123456789").SaveX(ctx) + require.False(t, client.User.Query().Where(user.NameEQ("alex")).ExistX(ctx)) + require.True(t, client.User.Query().Where(user.NameEqualFold("alex")).ExistX(ctx)) +} + func ContainsFold(t *testing.T, client *entv2.Client) { ctx := context.Background() t.Log("testing contains-fold on sql specific dialects") diff --git a/entc/load/bindata.go b/entc/load/bindata.go index 8eaf35117..e5b4a9117 100644 --- a/entc/load/bindata.go +++ b/entc/load/bindata.go @@ -1,4 +1,4 @@ -// Code generated by go-bindata. (@generated) DO NOT EDIT. +// Package load Code generated by go-bindata. (@generated) DO NOT EDIT. // sources: // template/main.tmpl // schema.go @@ -48,21 +48,32 @@ type bindataFileInfo struct { modTime time.Time } +// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } + +// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } + +// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } + +// Mode return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } + +// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - return false + return fi.mode&os.ModeDir != 0 } + +// Sys return file is sys mode func (fi bindataFileInfo) Sys() interface{} { return nil } @@ -82,7 +93,7 @@ func templateMainTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/main.tmpl", size: 647, mode: os.FileMode(420), modTime: time.Unix(1566131522, 0)} + info := bindataFileInfo{name: "template/main.tmpl", size: 647, mode: os.FileMode(420), modTime: time.Unix(1566138012, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -102,7 +113,7 @@ func schemaGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "schema.go", size: 4875, mode: os.FileMode(420), modTime: time.Unix(1566905362, 0)} + info := bindataFileInfo{name: "schema.go", size: 4875, mode: os.FileMode(420), modTime: time.Unix(1566925536, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/examples/m2m2types/ent/client.go b/examples/m2m2types/ent/client.go index c4e2e0ee1..74153f2d3 100644 --- a/examples/m2m2types/ent/client.go +++ b/examples/m2m2types/ent/client.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/config.go b/examples/m2m2types/ent/config.go index dbe938d37..7c345da10 100644 --- a/examples/m2m2types/ent/config.go +++ b/examples/m2m2types/ent/config.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/context.go b/examples/m2m2types/ent/context.go index f57bccf74..7f97cb6a6 100644 --- a/examples/m2m2types/ent/context.go +++ b/examples/m2m2types/ent/context.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/ent.go b/examples/m2m2types/ent/ent.go index 8e8d0e8d3..9da464624 100644 --- a/examples/m2m2types/ent/ent.go +++ b/examples/m2m2types/ent/ent.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/example_test.go b/examples/m2m2types/ent/example_test.go index a451da504..5c2e35be6 100644 --- a/examples/m2m2types/ent/example_test.go +++ b/examples/m2m2types/ent/example_test.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/group.go b/examples/m2m2types/ent/group.go index c0252455d..0a26617a8 100644 --- a/examples/m2m2types/ent/group.go +++ b/examples/m2m2types/ent/group.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/group/group.go b/examples/m2m2types/ent/group/group.go index dbcf82fc3..19a5f8ac9 100644 --- a/examples/m2m2types/ent/group/group.go +++ b/examples/m2m2types/ent/group/group.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package group diff --git a/examples/m2m2types/ent/group/where.go b/examples/m2m2types/ent/group/where.go index ff01cf135..9cc3059af 100644 --- a/examples/m2m2types/ent/group/where.go +++ b/examples/m2m2types/ent/group/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package group @@ -241,6 +237,15 @@ func NameHasSuffix(v string) predicate.Group { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.Group { + return predicate.Group( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.Group { return predicate.Group( diff --git a/examples/m2m2types/ent/group_create.go b/examples/m2m2types/ent/group_create.go index e51e596c4..70ac8495c 100644 --- a/examples/m2m2types/ent/group_create.go +++ b/examples/m2m2types/ent/group_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/group_delete.go b/examples/m2m2types/ent/group_delete.go index e553c9148..ba9776a1d 100644 --- a/examples/m2m2types/ent/group_delete.go +++ b/examples/m2m2types/ent/group_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/group_query.go b/examples/m2m2types/ent/group_query.go index e0fa912a0..e432c4381 100644 --- a/examples/m2m2types/ent/group_query.go +++ b/examples/m2m2types/ent/group_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/group_update.go b/examples/m2m2types/ent/group_update.go index 08c51410f..6e299688c 100644 --- a/examples/m2m2types/ent/group_update.go +++ b/examples/m2m2types/ent/group_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/migrate/migrate.go b/examples/m2m2types/ent/migrate/migrate.go index a237d2dfb..58765ba6f 100644 --- a/examples/m2m2types/ent/migrate/migrate.go +++ b/examples/m2m2types/ent/migrate/migrate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/m2m2types/ent/migrate/schema.go b/examples/m2m2types/ent/migrate/schema.go index 8e6cde896..53780213b 100644 --- a/examples/m2m2types/ent/migrate/schema.go +++ b/examples/m2m2types/ent/migrate/schema.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/m2m2types/ent/predicate/predicate.go b/examples/m2m2types/ent/predicate/predicate.go index b179da15c..8590a6ae4 100644 --- a/examples/m2m2types/ent/predicate/predicate.go +++ b/examples/m2m2types/ent/predicate/predicate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package predicate diff --git a/examples/m2m2types/ent/tx.go b/examples/m2m2types/ent/tx.go index 0549a904d..315cd48cb 100644 --- a/examples/m2m2types/ent/tx.go +++ b/examples/m2m2types/ent/tx.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/user.go b/examples/m2m2types/ent/user.go index ded6b6375..d7bd5e3e3 100644 --- a/examples/m2m2types/ent/user.go +++ b/examples/m2m2types/ent/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/user/user.go b/examples/m2m2types/ent/user/user.go index 220394641..c1202ac1e 100644 --- a/examples/m2m2types/ent/user/user.go +++ b/examples/m2m2types/ent/user/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user diff --git a/examples/m2m2types/ent/user/where.go b/examples/m2m2types/ent/user/where.go index ae789a993..bcc44e15f 100644 --- a/examples/m2m2types/ent/user/where.go +++ b/examples/m2m2types/ent/user/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user @@ -342,6 +338,15 @@ func NameHasSuffix(v string) predicate.User { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.User { return predicate.User( diff --git a/examples/m2m2types/ent/user_create.go b/examples/m2m2types/ent/user_create.go index 163cbbf06..8632a34b1 100644 --- a/examples/m2m2types/ent/user_create.go +++ b/examples/m2m2types/ent/user_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/user_delete.go b/examples/m2m2types/ent/user_delete.go index 9925b97b8..ea3f34563 100644 --- a/examples/m2m2types/ent/user_delete.go +++ b/examples/m2m2types/ent/user_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/user_query.go b/examples/m2m2types/ent/user_query.go index 3f5a7b404..0c17628a0 100644 --- a/examples/m2m2types/ent/user_query.go +++ b/examples/m2m2types/ent/user_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2m2types/ent/user_update.go b/examples/m2m2types/ent/user_update.go index 195f45bd8..b600b8b10 100644 --- a/examples/m2m2types/ent/user_update.go +++ b/examples/m2m2types/ent/user_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/client.go b/examples/m2mbidi/ent/client.go index 0c687db78..18b5238eb 100644 --- a/examples/m2mbidi/ent/client.go +++ b/examples/m2mbidi/ent/client.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/config.go b/examples/m2mbidi/ent/config.go index dbe938d37..7c345da10 100644 --- a/examples/m2mbidi/ent/config.go +++ b/examples/m2mbidi/ent/config.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/context.go b/examples/m2mbidi/ent/context.go index f57bccf74..7f97cb6a6 100644 --- a/examples/m2mbidi/ent/context.go +++ b/examples/m2mbidi/ent/context.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/ent.go b/examples/m2mbidi/ent/ent.go index 8e8d0e8d3..9da464624 100644 --- a/examples/m2mbidi/ent/ent.go +++ b/examples/m2mbidi/ent/ent.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/example_test.go b/examples/m2mbidi/ent/example_test.go index 1d5c9fcaa..f6a511b2c 100644 --- a/examples/m2mbidi/ent/example_test.go +++ b/examples/m2mbidi/ent/example_test.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/migrate/migrate.go b/examples/m2mbidi/ent/migrate/migrate.go index a237d2dfb..58765ba6f 100644 --- a/examples/m2mbidi/ent/migrate/migrate.go +++ b/examples/m2mbidi/ent/migrate/migrate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/m2mbidi/ent/migrate/schema.go b/examples/m2mbidi/ent/migrate/schema.go index e18987698..d56c733fd 100644 --- a/examples/m2mbidi/ent/migrate/schema.go +++ b/examples/m2mbidi/ent/migrate/schema.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/m2mbidi/ent/predicate/predicate.go b/examples/m2mbidi/ent/predicate/predicate.go index 06716f949..2bf74411f 100644 --- a/examples/m2mbidi/ent/predicate/predicate.go +++ b/examples/m2mbidi/ent/predicate/predicate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package predicate diff --git a/examples/m2mbidi/ent/tx.go b/examples/m2mbidi/ent/tx.go index 37533caf4..a26ee6b1f 100644 --- a/examples/m2mbidi/ent/tx.go +++ b/examples/m2mbidi/ent/tx.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/user.go b/examples/m2mbidi/ent/user.go index 027d28f40..9111d4c1f 100644 --- a/examples/m2mbidi/ent/user.go +++ b/examples/m2mbidi/ent/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/user/user.go b/examples/m2mbidi/ent/user/user.go index 65658a1fc..c0606b470 100644 --- a/examples/m2mbidi/ent/user/user.go +++ b/examples/m2mbidi/ent/user/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user diff --git a/examples/m2mbidi/ent/user/where.go b/examples/m2mbidi/ent/user/where.go index 2ebd26816..ff1a813f2 100644 --- a/examples/m2mbidi/ent/user/where.go +++ b/examples/m2mbidi/ent/user/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user @@ -342,6 +338,15 @@ func NameHasSuffix(v string) predicate.User { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.User { return predicate.User( diff --git a/examples/m2mbidi/ent/user_create.go b/examples/m2mbidi/ent/user_create.go index da0ba4507..6b0deca55 100644 --- a/examples/m2mbidi/ent/user_create.go +++ b/examples/m2mbidi/ent/user_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/user_delete.go b/examples/m2mbidi/ent/user_delete.go index b2e2a73ab..4670d68ef 100644 --- a/examples/m2mbidi/ent/user_delete.go +++ b/examples/m2mbidi/ent/user_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/user_query.go b/examples/m2mbidi/ent/user_query.go index dbce14041..79b35f523 100644 --- a/examples/m2mbidi/ent/user_query.go +++ b/examples/m2mbidi/ent/user_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mbidi/ent/user_update.go b/examples/m2mbidi/ent/user_update.go index 57537c051..32fd426a7 100644 --- a/examples/m2mbidi/ent/user_update.go +++ b/examples/m2mbidi/ent/user_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/client.go b/examples/m2mrecur/ent/client.go index f0723120f..d228eff83 100644 --- a/examples/m2mrecur/ent/client.go +++ b/examples/m2mrecur/ent/client.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/config.go b/examples/m2mrecur/ent/config.go index dbe938d37..7c345da10 100644 --- a/examples/m2mrecur/ent/config.go +++ b/examples/m2mrecur/ent/config.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/context.go b/examples/m2mrecur/ent/context.go index f57bccf74..7f97cb6a6 100644 --- a/examples/m2mrecur/ent/context.go +++ b/examples/m2mrecur/ent/context.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/ent.go b/examples/m2mrecur/ent/ent.go index 8e8d0e8d3..9da464624 100644 --- a/examples/m2mrecur/ent/ent.go +++ b/examples/m2mrecur/ent/ent.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/example_test.go b/examples/m2mrecur/ent/example_test.go index 65b34983c..9c0eb53a1 100644 --- a/examples/m2mrecur/ent/example_test.go +++ b/examples/m2mrecur/ent/example_test.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/migrate/migrate.go b/examples/m2mrecur/ent/migrate/migrate.go index a237d2dfb..58765ba6f 100644 --- a/examples/m2mrecur/ent/migrate/migrate.go +++ b/examples/m2mrecur/ent/migrate/migrate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/m2mrecur/ent/migrate/schema.go b/examples/m2mrecur/ent/migrate/schema.go index 3508b6049..65bd2bf15 100644 --- a/examples/m2mrecur/ent/migrate/schema.go +++ b/examples/m2mrecur/ent/migrate/schema.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/m2mrecur/ent/predicate/predicate.go b/examples/m2mrecur/ent/predicate/predicate.go index 06716f949..2bf74411f 100644 --- a/examples/m2mrecur/ent/predicate/predicate.go +++ b/examples/m2mrecur/ent/predicate/predicate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package predicate diff --git a/examples/m2mrecur/ent/tx.go b/examples/m2mrecur/ent/tx.go index b078d5d38..fcc85ef68 100644 --- a/examples/m2mrecur/ent/tx.go +++ b/examples/m2mrecur/ent/tx.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/user.go b/examples/m2mrecur/ent/user.go index b044ef501..bcecea43a 100644 --- a/examples/m2mrecur/ent/user.go +++ b/examples/m2mrecur/ent/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/user/user.go b/examples/m2mrecur/ent/user/user.go index 183c8669e..6cdc640a9 100644 --- a/examples/m2mrecur/ent/user/user.go +++ b/examples/m2mrecur/ent/user/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user diff --git a/examples/m2mrecur/ent/user/where.go b/examples/m2mrecur/ent/user/where.go index f529f1dcb..51222d2af 100644 --- a/examples/m2mrecur/ent/user/where.go +++ b/examples/m2mrecur/ent/user/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user @@ -342,6 +338,15 @@ func NameHasSuffix(v string) predicate.User { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.User { return predicate.User( diff --git a/examples/m2mrecur/ent/user_create.go b/examples/m2mrecur/ent/user_create.go index f591fd436..f5ab9e74a 100644 --- a/examples/m2mrecur/ent/user_create.go +++ b/examples/m2mrecur/ent/user_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/user_delete.go b/examples/m2mrecur/ent/user_delete.go index 4cea8a8b2..424a0b978 100644 --- a/examples/m2mrecur/ent/user_delete.go +++ b/examples/m2mrecur/ent/user_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/user_query.go b/examples/m2mrecur/ent/user_query.go index 2563f5c7d..a77b3c5a1 100644 --- a/examples/m2mrecur/ent/user_query.go +++ b/examples/m2mrecur/ent/user_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/m2mrecur/ent/user_update.go b/examples/m2mrecur/ent/user_update.go index b59d0ac50..e6f772ddf 100644 --- a/examples/m2mrecur/ent/user_update.go +++ b/examples/m2mrecur/ent/user_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/client.go b/examples/o2m2types/ent/client.go index a51dbe425..374400fc1 100644 --- a/examples/o2m2types/ent/client.go +++ b/examples/o2m2types/ent/client.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/config.go b/examples/o2m2types/ent/config.go index dbe938d37..7c345da10 100644 --- a/examples/o2m2types/ent/config.go +++ b/examples/o2m2types/ent/config.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/context.go b/examples/o2m2types/ent/context.go index f57bccf74..7f97cb6a6 100644 --- a/examples/o2m2types/ent/context.go +++ b/examples/o2m2types/ent/context.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/ent.go b/examples/o2m2types/ent/ent.go index 8e8d0e8d3..9da464624 100644 --- a/examples/o2m2types/ent/ent.go +++ b/examples/o2m2types/ent/ent.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/example_test.go b/examples/o2m2types/ent/example_test.go index 4e58e543a..892568c6f 100644 --- a/examples/o2m2types/ent/example_test.go +++ b/examples/o2m2types/ent/example_test.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/migrate/migrate.go b/examples/o2m2types/ent/migrate/migrate.go index a237d2dfb..58765ba6f 100644 --- a/examples/o2m2types/ent/migrate/migrate.go +++ b/examples/o2m2types/ent/migrate/migrate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2m2types/ent/migrate/schema.go b/examples/o2m2types/ent/migrate/schema.go index c55ffdf72..9cb41710c 100644 --- a/examples/o2m2types/ent/migrate/schema.go +++ b/examples/o2m2types/ent/migrate/schema.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2m2types/ent/pet.go b/examples/o2m2types/ent/pet.go index 354c4c544..9a1e175b1 100644 --- a/examples/o2m2types/ent/pet.go +++ b/examples/o2m2types/ent/pet.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/pet/pet.go b/examples/o2m2types/ent/pet/pet.go index f31ae040e..c01b92f64 100644 --- a/examples/o2m2types/ent/pet/pet.go +++ b/examples/o2m2types/ent/pet/pet.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package pet diff --git a/examples/o2m2types/ent/pet/where.go b/examples/o2m2types/ent/pet/where.go index 4e4f8b8f2..860270ee2 100644 --- a/examples/o2m2types/ent/pet/where.go +++ b/examples/o2m2types/ent/pet/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package pet @@ -241,6 +237,15 @@ func NameHasSuffix(v string) predicate.Pet { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.Pet { + return predicate.Pet( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.Pet { return predicate.Pet( diff --git a/examples/o2m2types/ent/pet_create.go b/examples/o2m2types/ent/pet_create.go index 550b6baea..74163a728 100644 --- a/examples/o2m2types/ent/pet_create.go +++ b/examples/o2m2types/ent/pet_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/pet_delete.go b/examples/o2m2types/ent/pet_delete.go index f7abbbd0e..42d61d4c9 100644 --- a/examples/o2m2types/ent/pet_delete.go +++ b/examples/o2m2types/ent/pet_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/pet_query.go b/examples/o2m2types/ent/pet_query.go index c87891200..ecde22556 100644 --- a/examples/o2m2types/ent/pet_query.go +++ b/examples/o2m2types/ent/pet_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/pet_update.go b/examples/o2m2types/ent/pet_update.go index d043b5d4a..f0a2a43bf 100644 --- a/examples/o2m2types/ent/pet_update.go +++ b/examples/o2m2types/ent/pet_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/predicate/predicate.go b/examples/o2m2types/ent/predicate/predicate.go index 4178724aa..528a925d4 100644 --- a/examples/o2m2types/ent/predicate/predicate.go +++ b/examples/o2m2types/ent/predicate/predicate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package predicate diff --git a/examples/o2m2types/ent/tx.go b/examples/o2m2types/ent/tx.go index e46272df4..3c22cb59d 100644 --- a/examples/o2m2types/ent/tx.go +++ b/examples/o2m2types/ent/tx.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/user.go b/examples/o2m2types/ent/user.go index 6742321fa..a480cf607 100644 --- a/examples/o2m2types/ent/user.go +++ b/examples/o2m2types/ent/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/user/user.go b/examples/o2m2types/ent/user/user.go index 2f8f8ee35..9c5ce5b97 100644 --- a/examples/o2m2types/ent/user/user.go +++ b/examples/o2m2types/ent/user/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user diff --git a/examples/o2m2types/ent/user/where.go b/examples/o2m2types/ent/user/where.go index dbbc95497..1145100a6 100644 --- a/examples/o2m2types/ent/user/where.go +++ b/examples/o2m2types/ent/user/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user @@ -342,6 +338,15 @@ func NameHasSuffix(v string) predicate.User { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.User { return predicate.User( diff --git a/examples/o2m2types/ent/user_create.go b/examples/o2m2types/ent/user_create.go index 4c5e72110..c79f3a069 100644 --- a/examples/o2m2types/ent/user_create.go +++ b/examples/o2m2types/ent/user_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/user_delete.go b/examples/o2m2types/ent/user_delete.go index 20c7a4998..9574104db 100644 --- a/examples/o2m2types/ent/user_delete.go +++ b/examples/o2m2types/ent/user_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/user_query.go b/examples/o2m2types/ent/user_query.go index 4c0380236..288293ffe 100644 --- a/examples/o2m2types/ent/user_query.go +++ b/examples/o2m2types/ent/user_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2m2types/ent/user_update.go b/examples/o2m2types/ent/user_update.go index 02a5526db..9f847f3f3 100644 --- a/examples/o2m2types/ent/user_update.go +++ b/examples/o2m2types/ent/user_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/client.go b/examples/o2mrecur/ent/client.go index 7031399d1..0502fa74b 100644 --- a/examples/o2mrecur/ent/client.go +++ b/examples/o2mrecur/ent/client.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/config.go b/examples/o2mrecur/ent/config.go index dbe938d37..7c345da10 100644 --- a/examples/o2mrecur/ent/config.go +++ b/examples/o2mrecur/ent/config.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/context.go b/examples/o2mrecur/ent/context.go index f57bccf74..7f97cb6a6 100644 --- a/examples/o2mrecur/ent/context.go +++ b/examples/o2mrecur/ent/context.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/ent.go b/examples/o2mrecur/ent/ent.go index 8e8d0e8d3..9da464624 100644 --- a/examples/o2mrecur/ent/ent.go +++ b/examples/o2mrecur/ent/ent.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/example_test.go b/examples/o2mrecur/ent/example_test.go index 23d108267..2cf874301 100644 --- a/examples/o2mrecur/ent/example_test.go +++ b/examples/o2mrecur/ent/example_test.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/migrate/migrate.go b/examples/o2mrecur/ent/migrate/migrate.go index a237d2dfb..58765ba6f 100644 --- a/examples/o2mrecur/ent/migrate/migrate.go +++ b/examples/o2mrecur/ent/migrate/migrate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2mrecur/ent/migrate/schema.go b/examples/o2mrecur/ent/migrate/schema.go index d4f8fdea5..2222d7c64 100644 --- a/examples/o2mrecur/ent/migrate/schema.go +++ b/examples/o2mrecur/ent/migrate/schema.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2mrecur/ent/node.go b/examples/o2mrecur/ent/node.go index fe40850c9..e56a08e22 100644 --- a/examples/o2mrecur/ent/node.go +++ b/examples/o2mrecur/ent/node.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/node/node.go b/examples/o2mrecur/ent/node/node.go index 03aa1323a..0aaffffe5 100644 --- a/examples/o2mrecur/ent/node/node.go +++ b/examples/o2mrecur/ent/node/node.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package node diff --git a/examples/o2mrecur/ent/node/where.go b/examples/o2mrecur/ent/node/where.go index 8fe59e95b..9ae649754 100644 --- a/examples/o2mrecur/ent/node/where.go +++ b/examples/o2mrecur/ent/node/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package node diff --git a/examples/o2mrecur/ent/node_create.go b/examples/o2mrecur/ent/node_create.go index 06dc99d00..eae9310a9 100644 --- a/examples/o2mrecur/ent/node_create.go +++ b/examples/o2mrecur/ent/node_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/node_delete.go b/examples/o2mrecur/ent/node_delete.go index a9ff3ed13..88d3deb26 100644 --- a/examples/o2mrecur/ent/node_delete.go +++ b/examples/o2mrecur/ent/node_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/node_query.go b/examples/o2mrecur/ent/node_query.go index 9cddf56bd..edea8f286 100644 --- a/examples/o2mrecur/ent/node_query.go +++ b/examples/o2mrecur/ent/node_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/node_update.go b/examples/o2mrecur/ent/node_update.go index 5641cdfd3..d1e6577f4 100644 --- a/examples/o2mrecur/ent/node_update.go +++ b/examples/o2mrecur/ent/node_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2mrecur/ent/predicate/predicate.go b/examples/o2mrecur/ent/predicate/predicate.go index 975cfe00d..ba1cc35e5 100644 --- a/examples/o2mrecur/ent/predicate/predicate.go +++ b/examples/o2mrecur/ent/predicate/predicate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package predicate diff --git a/examples/o2mrecur/ent/tx.go b/examples/o2mrecur/ent/tx.go index 05e14e9e4..1d3102e7e 100644 --- a/examples/o2mrecur/ent/tx.go +++ b/examples/o2mrecur/ent/tx.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/card.go b/examples/o2o2types/ent/card.go index af6a6710b..45aabb51f 100644 --- a/examples/o2o2types/ent/card.go +++ b/examples/o2o2types/ent/card.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/card/card.go b/examples/o2o2types/ent/card/card.go index 21ba53836..11ee78748 100644 --- a/examples/o2o2types/ent/card/card.go +++ b/examples/o2o2types/ent/card/card.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package card diff --git a/examples/o2o2types/ent/card/where.go b/examples/o2o2types/ent/card/where.go index ff9cf0309..5cf57b8dc 100644 --- a/examples/o2o2types/ent/card/where.go +++ b/examples/o2o2types/ent/card/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package card @@ -344,6 +340,15 @@ func NumberHasSuffix(v string) predicate.Card { ) } +// NumberEqualFold applies the EqualFold predicate on the "number" field. +func NumberEqualFold(v string) predicate.Card { + return predicate.Card( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldNumber), v)) + }, + ) +} + // NumberContainsFold applies the ContainsFold predicate on the "number" field. func NumberContainsFold(v string) predicate.Card { return predicate.Card( diff --git a/examples/o2o2types/ent/card_create.go b/examples/o2o2types/ent/card_create.go index fdea80531..1990f4aef 100644 --- a/examples/o2o2types/ent/card_create.go +++ b/examples/o2o2types/ent/card_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/card_delete.go b/examples/o2o2types/ent/card_delete.go index c3bd8b3a4..f720bc81b 100644 --- a/examples/o2o2types/ent/card_delete.go +++ b/examples/o2o2types/ent/card_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/card_query.go b/examples/o2o2types/ent/card_query.go index 4f0f37748..434e7a15d 100644 --- a/examples/o2o2types/ent/card_query.go +++ b/examples/o2o2types/ent/card_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/card_update.go b/examples/o2o2types/ent/card_update.go index 48d710c11..6a39e0f6b 100644 --- a/examples/o2o2types/ent/card_update.go +++ b/examples/o2o2types/ent/card_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/client.go b/examples/o2o2types/ent/client.go index d2ceef139..839bd5583 100644 --- a/examples/o2o2types/ent/client.go +++ b/examples/o2o2types/ent/client.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/config.go b/examples/o2o2types/ent/config.go index dbe938d37..7c345da10 100644 --- a/examples/o2o2types/ent/config.go +++ b/examples/o2o2types/ent/config.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/context.go b/examples/o2o2types/ent/context.go index f57bccf74..7f97cb6a6 100644 --- a/examples/o2o2types/ent/context.go +++ b/examples/o2o2types/ent/context.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/ent.go b/examples/o2o2types/ent/ent.go index 8e8d0e8d3..9da464624 100644 --- a/examples/o2o2types/ent/ent.go +++ b/examples/o2o2types/ent/ent.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/example_test.go b/examples/o2o2types/ent/example_test.go index aee3acf1f..752db905e 100644 --- a/examples/o2o2types/ent/example_test.go +++ b/examples/o2o2types/ent/example_test.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/migrate/migrate.go b/examples/o2o2types/ent/migrate/migrate.go index a237d2dfb..58765ba6f 100644 --- a/examples/o2o2types/ent/migrate/migrate.go +++ b/examples/o2o2types/ent/migrate/migrate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2o2types/ent/migrate/schema.go b/examples/o2o2types/ent/migrate/schema.go index 237a32ba4..804b65729 100644 --- a/examples/o2o2types/ent/migrate/schema.go +++ b/examples/o2o2types/ent/migrate/schema.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2o2types/ent/predicate/predicate.go b/examples/o2o2types/ent/predicate/predicate.go index 8eb10220a..c9260f2ef 100644 --- a/examples/o2o2types/ent/predicate/predicate.go +++ b/examples/o2o2types/ent/predicate/predicate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package predicate diff --git a/examples/o2o2types/ent/tx.go b/examples/o2o2types/ent/tx.go index c67050aa3..b1464e8f7 100644 --- a/examples/o2o2types/ent/tx.go +++ b/examples/o2o2types/ent/tx.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/user.go b/examples/o2o2types/ent/user.go index d6be9c4bd..236c0fc0e 100644 --- a/examples/o2o2types/ent/user.go +++ b/examples/o2o2types/ent/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/user/user.go b/examples/o2o2types/ent/user/user.go index 6dec37ffe..7211a9f7a 100644 --- a/examples/o2o2types/ent/user/user.go +++ b/examples/o2o2types/ent/user/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user diff --git a/examples/o2o2types/ent/user/where.go b/examples/o2o2types/ent/user/where.go index ec2b62c02..82b5c88c6 100644 --- a/examples/o2o2types/ent/user/where.go +++ b/examples/o2o2types/ent/user/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user @@ -342,6 +338,15 @@ func NameHasSuffix(v string) predicate.User { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.User { return predicate.User( diff --git a/examples/o2o2types/ent/user_create.go b/examples/o2o2types/ent/user_create.go index fd5343b40..48d4d0a6f 100644 --- a/examples/o2o2types/ent/user_create.go +++ b/examples/o2o2types/ent/user_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/user_delete.go b/examples/o2o2types/ent/user_delete.go index dbf123050..8ee1c6733 100644 --- a/examples/o2o2types/ent/user_delete.go +++ b/examples/o2o2types/ent/user_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/user_query.go b/examples/o2o2types/ent/user_query.go index 3016f096b..1ab354d8b 100644 --- a/examples/o2o2types/ent/user_query.go +++ b/examples/o2o2types/ent/user_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2o2types/ent/user_update.go b/examples/o2o2types/ent/user_update.go index 38db8d1bb..928167f7f 100644 --- a/examples/o2o2types/ent/user_update.go +++ b/examples/o2o2types/ent/user_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/client.go b/examples/o2obidi/ent/client.go index 53e05d8ab..0baa49188 100644 --- a/examples/o2obidi/ent/client.go +++ b/examples/o2obidi/ent/client.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/config.go b/examples/o2obidi/ent/config.go index dbe938d37..7c345da10 100644 --- a/examples/o2obidi/ent/config.go +++ b/examples/o2obidi/ent/config.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/context.go b/examples/o2obidi/ent/context.go index f57bccf74..7f97cb6a6 100644 --- a/examples/o2obidi/ent/context.go +++ b/examples/o2obidi/ent/context.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/ent.go b/examples/o2obidi/ent/ent.go index 8e8d0e8d3..9da464624 100644 --- a/examples/o2obidi/ent/ent.go +++ b/examples/o2obidi/ent/ent.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/example_test.go b/examples/o2obidi/ent/example_test.go index 8a054f088..7d7bac802 100644 --- a/examples/o2obidi/ent/example_test.go +++ b/examples/o2obidi/ent/example_test.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/migrate/migrate.go b/examples/o2obidi/ent/migrate/migrate.go index a237d2dfb..58765ba6f 100644 --- a/examples/o2obidi/ent/migrate/migrate.go +++ b/examples/o2obidi/ent/migrate/migrate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2obidi/ent/migrate/schema.go b/examples/o2obidi/ent/migrate/schema.go index bb55190ea..b842bfbba 100644 --- a/examples/o2obidi/ent/migrate/schema.go +++ b/examples/o2obidi/ent/migrate/schema.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2obidi/ent/predicate/predicate.go b/examples/o2obidi/ent/predicate/predicate.go index 06716f949..2bf74411f 100644 --- a/examples/o2obidi/ent/predicate/predicate.go +++ b/examples/o2obidi/ent/predicate/predicate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package predicate diff --git a/examples/o2obidi/ent/tx.go b/examples/o2obidi/ent/tx.go index ddd4c88c6..0bef1f9d9 100644 --- a/examples/o2obidi/ent/tx.go +++ b/examples/o2obidi/ent/tx.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/user.go b/examples/o2obidi/ent/user.go index 8f60ebb22..3e30096b9 100644 --- a/examples/o2obidi/ent/user.go +++ b/examples/o2obidi/ent/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/user/user.go b/examples/o2obidi/ent/user/user.go index 858b6b961..4d4b86987 100644 --- a/examples/o2obidi/ent/user/user.go +++ b/examples/o2obidi/ent/user/user.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user diff --git a/examples/o2obidi/ent/user/where.go b/examples/o2obidi/ent/user/where.go index ba875cb85..6231c6765 100644 --- a/examples/o2obidi/ent/user/where.go +++ b/examples/o2obidi/ent/user/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package user @@ -342,6 +338,15 @@ func NameHasSuffix(v string) predicate.User { ) } +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.User { + return predicate.User( + func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldName), v)) + }, + ) +} + // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.User { return predicate.User( diff --git a/examples/o2obidi/ent/user_create.go b/examples/o2obidi/ent/user_create.go index 307855bfc..69d83b3f3 100644 --- a/examples/o2obidi/ent/user_create.go +++ b/examples/o2obidi/ent/user_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/user_delete.go b/examples/o2obidi/ent/user_delete.go index e60343847..be2d13702 100644 --- a/examples/o2obidi/ent/user_delete.go +++ b/examples/o2obidi/ent/user_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/user_query.go b/examples/o2obidi/ent/user_query.go index edffaa899..757e9ed49 100644 --- a/examples/o2obidi/ent/user_query.go +++ b/examples/o2obidi/ent/user_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2obidi/ent/user_update.go b/examples/o2obidi/ent/user_update.go index a4c512fe3..fa1d04fc8 100644 --- a/examples/o2obidi/ent/user_update.go +++ b/examples/o2obidi/ent/user_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/client.go b/examples/o2orecur/ent/client.go index aa793a9ff..e3b8cf1b1 100644 --- a/examples/o2orecur/ent/client.go +++ b/examples/o2orecur/ent/client.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/config.go b/examples/o2orecur/ent/config.go index dbe938d37..7c345da10 100644 --- a/examples/o2orecur/ent/config.go +++ b/examples/o2orecur/ent/config.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/context.go b/examples/o2orecur/ent/context.go index f57bccf74..7f97cb6a6 100644 --- a/examples/o2orecur/ent/context.go +++ b/examples/o2orecur/ent/context.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/ent.go b/examples/o2orecur/ent/ent.go index 8e8d0e8d3..9da464624 100644 --- a/examples/o2orecur/ent/ent.go +++ b/examples/o2orecur/ent/ent.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/example_test.go b/examples/o2orecur/ent/example_test.go index a4459830f..53592a070 100644 --- a/examples/o2orecur/ent/example_test.go +++ b/examples/o2orecur/ent/example_test.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/migrate/migrate.go b/examples/o2orecur/ent/migrate/migrate.go index a237d2dfb..58765ba6f 100644 --- a/examples/o2orecur/ent/migrate/migrate.go +++ b/examples/o2orecur/ent/migrate/migrate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2orecur/ent/migrate/schema.go b/examples/o2orecur/ent/migrate/schema.go index 737499be3..aa68b2f49 100644 --- a/examples/o2orecur/ent/migrate/schema.go +++ b/examples/o2orecur/ent/migrate/schema.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package migrate diff --git a/examples/o2orecur/ent/node.go b/examples/o2orecur/ent/node.go index d99017993..5c6080e42 100644 --- a/examples/o2orecur/ent/node.go +++ b/examples/o2orecur/ent/node.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/node/node.go b/examples/o2orecur/ent/node/node.go index 2749a2fe1..dd3c9dcbe 100644 --- a/examples/o2orecur/ent/node/node.go +++ b/examples/o2orecur/ent/node/node.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package node diff --git a/examples/o2orecur/ent/node/where.go b/examples/o2orecur/ent/node/where.go index 65da08839..331d17585 100644 --- a/examples/o2orecur/ent/node/where.go +++ b/examples/o2orecur/ent/node/where.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package node diff --git a/examples/o2orecur/ent/node_create.go b/examples/o2orecur/ent/node_create.go index 532961cd5..f30263ec9 100644 --- a/examples/o2orecur/ent/node_create.go +++ b/examples/o2orecur/ent/node_create.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/node_delete.go b/examples/o2orecur/ent/node_delete.go index 3d0324b5c..ccdb9f8a5 100644 --- a/examples/o2orecur/ent/node_delete.go +++ b/examples/o2orecur/ent/node_delete.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/node_query.go b/examples/o2orecur/ent/node_query.go index 90378e33e..ff5ffdb05 100644 --- a/examples/o2orecur/ent/node_query.go +++ b/examples/o2orecur/ent/node_query.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/node_update.go b/examples/o2orecur/ent/node_update.go index b315fe2f6..6f797d62e 100644 --- a/examples/o2orecur/ent/node_update.go +++ b/examples/o2orecur/ent/node_update.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/examples/o2orecur/ent/predicate/predicate.go b/examples/o2orecur/ent/predicate/predicate.go index 975cfe00d..ba1cc35e5 100644 --- a/examples/o2orecur/ent/predicate/predicate.go +++ b/examples/o2orecur/ent/predicate/predicate.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package predicate diff --git a/examples/o2orecur/ent/tx.go b/examples/o2orecur/ent/tx.go index af7964b85..314d9173d 100644 --- a/examples/o2orecur/ent/tx.go +++ b/examples/o2orecur/ent/tx.go @@ -1,7 +1,3 @@ -// Copyright 2019-present Facebook Inc. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - // Code generated (@generated) by entc, DO NOT EDIT. package ent diff --git a/schema/field/gen/numeric.tmpl b/schema/field/gen/numeric.tmpl index 89b260b7b..847a745e2 100644 --- a/schema/field/gen/numeric.tmpl +++ b/schema/field/gen/numeric.tmpl @@ -1,4 +1,8 @@ {{ define "numeric" }} +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + package field import "errors"