From e493574c832bb066f7d66d0b9957a4daf8ada146 Mon Sep 17 00:00:00 2001 From: Ariel Mashraki Date: Thu, 24 Oct 2019 10:47:15 -0700 Subject: [PATCH] entc: add postgres dialect for sql storage driver options Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/123 Reviewed By: alexsn Differential Revision: D18117641 fbshipit-source-id: 8e520a1b1f70c7bea70f8a37ac698116e98a804e --- entc/gen/storage.go | 2 +- entc/integration/config/ent/client.go | 2 +- entc/integration/ent/card_create.go | 2 +- entc/integration/ent/card_delete.go | 2 +- entc/integration/ent/card_query.go | 16 ++++---- entc/integration/ent/card_update.go | 4 +- entc/integration/ent/client.go | 50 ++++++++++++------------ entc/integration/ent/comment_create.go | 2 +- entc/integration/ent/comment_delete.go | 2 +- entc/integration/ent/comment_query.go | 14 +++---- entc/integration/ent/comment_update.go | 4 +- entc/integration/ent/fieldtype_create.go | 2 +- entc/integration/ent/fieldtype_delete.go | 2 +- entc/integration/ent/fieldtype_query.go | 14 +++---- entc/integration/ent/fieldtype_update.go | 4 +- entc/integration/ent/file_create.go | 2 +- entc/integration/ent/file_delete.go | 2 +- entc/integration/ent/file_query.go | 18 ++++----- entc/integration/ent/file_update.go | 4 +- entc/integration/ent/filetype_create.go | 2 +- entc/integration/ent/filetype_delete.go | 2 +- entc/integration/ent/filetype_query.go | 16 ++++---- entc/integration/ent/filetype_update.go | 4 +- entc/integration/ent/group_create.go | 2 +- entc/integration/ent/group_delete.go | 2 +- entc/integration/ent/group_query.go | 22 +++++------ entc/integration/ent/group_update.go | 4 +- entc/integration/ent/groupinfo_create.go | 2 +- entc/integration/ent/groupinfo_delete.go | 2 +- entc/integration/ent/groupinfo_query.go | 16 ++++---- entc/integration/ent/groupinfo_update.go | 4 +- entc/integration/ent/item_create.go | 2 +- entc/integration/ent/item_delete.go | 2 +- entc/integration/ent/item_query.go | 14 +++---- entc/integration/ent/item_update.go | 4 +- entc/integration/ent/node_create.go | 2 +- entc/integration/ent/node_delete.go | 2 +- entc/integration/ent/node_query.go | 18 ++++----- entc/integration/ent/node_update.go | 4 +- entc/integration/ent/pet_create.go | 2 +- entc/integration/ent/pet_delete.go | 2 +- entc/integration/ent/pet_query.go | 18 ++++----- entc/integration/ent/pet_update.go | 4 +- entc/integration/ent/user_create.go | 2 +- entc/integration/ent/user_delete.go | 2 +- entc/integration/ent/user_query.go | 36 ++++++++--------- entc/integration/ent/user_update.go | 4 +- entc/integration/idtype/ent/client.go | 2 +- entc/integration/json/ent/client.go | 2 +- entc/integration/migrate/entv1/client.go | 2 +- entc/integration/migrate/entv2/client.go | 2 +- entc/integration/template/ent/client.go | 2 +- examples/edgeindex/ent/client.go | 2 +- examples/entcpkg/ent/client.go | 2 +- examples/m2m2types/ent/client.go | 2 +- examples/m2mbidi/ent/client.go | 2 +- examples/m2mrecur/ent/client.go | 2 +- examples/o2m2types/ent/client.go | 2 +- examples/o2mrecur/ent/client.go | 2 +- examples/o2o2types/ent/client.go | 2 +- examples/o2obidi/ent/client.go | 2 +- examples/o2orecur/ent/client.go | 2 +- examples/start/ent/client.go | 2 +- examples/traversal/ent/client.go | 2 +- 64 files changed, 189 insertions(+), 189 deletions(-) diff --git a/entc/gen/storage.go b/entc/gen/storage.go index 6a59ba85e..28b451596 100644 --- a/entc/gen/storage.go +++ b/entc/gen/storage.go @@ -47,7 +47,7 @@ var drivers = []*Storage{ Name: "sql", IdentName: "SQL", Builder: reflect.TypeOf(&sql.Selector{}), - Dialects: []string{"dialect.SQLite", "dialect.MySQL"}, + Dialects: []string{"dialect.SQLite", "dialect.MySQL", "dialect.Postgres"}, Imports: []string{ "github.com/facebookincubator/ent/dialect/sql", }, diff --git a/entc/integration/config/ent/client.go b/entc/integration/config/ent/client.go index 0c1cb7a19..627d1c860 100644 --- a/entc/integration/config/ent/client.go +++ b/entc/integration/config/ent/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/entc/integration/ent/card_create.go b/entc/integration/ent/card_create.go index c4a798d8f..dfdd2310d 100644 --- a/entc/integration/ent/card_create.go +++ b/entc/integration/ent/card_create.go @@ -109,7 +109,7 @@ func (cc *CardCreate) Save(ctx context.Context) (*Card, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"owner\"") } switch cc.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cc.sqlSave(ctx) case dialect.Gremlin: return cc.gremlinSave(ctx) diff --git a/entc/integration/ent/card_delete.go b/entc/integration/ent/card_delete.go index ff3c2d774..e0adbce95 100644 --- a/entc/integration/ent/card_delete.go +++ b/entc/integration/ent/card_delete.go @@ -35,7 +35,7 @@ func (cd *CardDelete) Where(ps ...predicate.Card) *CardDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (cd *CardDelete) Exec(ctx context.Context) (int, error) { switch cd.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cd.sqlExec(ctx) case dialect.Gremlin: return cd.gremlinExec(ctx) diff --git a/entc/integration/ent/card_query.go b/entc/integration/ent/card_query.go index d2b107ecc..36d207ac7 100644 --- a/entc/integration/ent/card_query.go +++ b/entc/integration/ent/card_query.go @@ -64,7 +64,7 @@ func (cq *CardQuery) Order(o ...Order) *CardQuery { func (cq *CardQuery) QueryOwner() *UserQuery { query := &UserQuery{config: cq.config} switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := cq.sqlQuery() t2.Select(t2.C(card.OwnerColumn)) @@ -176,7 +176,7 @@ func (cq *CardQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of Cards. func (cq *CardQuery) All(ctx context.Context) ([]*Card, error) { switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cq.sqlAll(ctx) case dialect.Gremlin: return cq.gremlinAll(ctx) @@ -215,7 +215,7 @@ func (cq *CardQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (cq *CardQuery) Count(ctx context.Context) (int, error) { switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cq.sqlCount(ctx) case dialect.Gremlin: return cq.gremlinCount(ctx) @@ -236,7 +236,7 @@ func (cq *CardQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (cq *CardQuery) Exist(ctx context.Context) (bool, error) { switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cq.sqlExist(ctx) case dialect.Gremlin: return cq.gremlinExist(ctx) @@ -289,7 +289,7 @@ func (cq *CardQuery) GroupBy(field string, fields ...string) *CardGroupBy { group := &CardGroupBy{config: cq.config} group.fields = append([]string{field}, fields...) switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = cq.sqlQuery() case dialect.Gremlin: group.gremlin = cq.gremlinQuery() @@ -313,7 +313,7 @@ func (cq *CardQuery) Select(field string, fields ...string) *CardSelect { selector := &CardSelect{config: cq.config} selector.fields = append([]string{field}, fields...) switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = cq.sqlQuery() case dialect.Gremlin: selector.gremlin = cq.gremlinQuery() @@ -474,7 +474,7 @@ func (cgb *CardGroupBy) Aggregate(fns ...Aggregate) *CardGroupBy { // Scan applies the group-by query and scan the result into the given value. func (cgb *CardGroupBy) Scan(ctx context.Context, v interface{}) error { switch cgb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cgb.sqlScan(ctx, v) case dialect.Gremlin: return cgb.gremlinScan(ctx, v) @@ -643,7 +643,7 @@ type CardSelect struct { // Scan applies the selector query and scan the result into the given value. func (cs *CardSelect) Scan(ctx context.Context, v interface{}) error { switch cs.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cs.sqlScan(ctx, v) case dialect.Gremlin: return cs.gremlinScan(ctx, v) diff --git a/entc/integration/ent/card_update.go b/entc/integration/ent/card_update.go index 485db0a67..3a7eb10f0 100644 --- a/entc/integration/ent/card_update.go +++ b/entc/integration/ent/card_update.go @@ -91,7 +91,7 @@ func (cu *CardUpdate) Save(ctx context.Context) (int, error) { return 0, errors.New("ent: multiple assignments on a unique edge \"owner\"") } switch cu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cu.sqlSave(ctx) case dialect.Gremlin: return cu.gremlinSave(ctx) @@ -322,7 +322,7 @@ func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"owner\"") } switch cuo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cuo.sqlSave(ctx) case dialect.Gremlin: return cuo.gremlinSave(ctx) diff --git a/entc/integration/ent/client.go b/entc/integration/ent/client.go index 0a5658ec7..1f1ee28a2 100644 --- a/entc/integration/ent/client.go +++ b/entc/integration/ent/client.go @@ -87,7 +87,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err @@ -243,7 +243,7 @@ func (c *CardClient) GetX(ctx context.Context, id string) *Card { func (c *CardClient) QueryOwner(ca *Card) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := ca.id() t1 := sql.Table(user.Table) t2 := sql.Select(card.OwnerColumn). @@ -454,7 +454,7 @@ func (c *FileClient) GetX(ctx context.Context, id string) *File { func (c *FileClient) QueryOwner(f *File) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := f.id() t1 := sql.Table(user.Table) t2 := sql.Select(file.OwnerColumn). @@ -473,7 +473,7 @@ func (c *FileClient) QueryOwner(f *File) *UserQuery { func (c *FileClient) QueryType(f *File) *FileTypeQuery { query := &FileTypeQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := f.id() t1 := sql.Table(filetype.Table) t2 := sql.Select(file.TypeColumn). @@ -556,7 +556,7 @@ func (c *FileTypeClient) GetX(ctx context.Context, id string) *FileType { func (c *FileTypeClient) QueryFiles(ft *FileType) *FileQuery { query := &FileQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := ft.id() query.sql = sql.Select().From(sql.Table(file.Table)). Where(sql.EQ(filetype.FilesColumn, id)) @@ -636,7 +636,7 @@ func (c *GroupClient) GetX(ctx context.Context, id string) *Group { func (c *GroupClient) QueryFiles(gr *Group) *FileQuery { query := &FileQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := gr.id() query.sql = sql.Select().From(sql.Table(file.Table)). Where(sql.EQ(group.FilesColumn, id)) @@ -652,7 +652,7 @@ func (c *GroupClient) QueryFiles(gr *Group) *FileQuery { func (c *GroupClient) QueryBlocked(gr *Group) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := gr.id() query.sql = sql.Select().From(sql.Table(user.Table)). Where(sql.EQ(group.BlockedColumn, id)) @@ -668,7 +668,7 @@ func (c *GroupClient) QueryBlocked(gr *Group) *UserQuery { func (c *GroupClient) QueryUsers(gr *Group) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := gr.id() t1 := sql.Table(user.Table) t2 := sql.Table(group.Table) @@ -694,7 +694,7 @@ func (c *GroupClient) QueryUsers(gr *Group) *UserQuery { func (c *GroupClient) QueryInfo(gr *Group) *GroupInfoQuery { query := &GroupInfoQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := gr.id() t1 := sql.Table(groupinfo.Table) t2 := sql.Select(group.InfoColumn). @@ -777,7 +777,7 @@ func (c *GroupInfoClient) GetX(ctx context.Context, id string) *GroupInfo { func (c *GroupInfoClient) QueryGroups(gi *GroupInfo) *GroupQuery { query := &GroupQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := gi.id() query.sql = sql.Select().From(sql.Table(group.Table)). Where(sql.EQ(groupinfo.GroupsColumn, id)) @@ -921,7 +921,7 @@ func (c *NodeClient) GetX(ctx context.Context, id string) *Node { func (c *NodeClient) QueryPrev(n *Node) *NodeQuery { query := &NodeQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := n.id() t1 := sql.Table(node.Table) t2 := sql.Select(node.PrevColumn). @@ -940,7 +940,7 @@ func (c *NodeClient) QueryPrev(n *Node) *NodeQuery { func (c *NodeClient) QueryNext(n *Node) *NodeQuery { query := &NodeQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := n.id() query.sql = sql.Select().From(sql.Table(node.Table)). Where(sql.EQ(node.NextColumn, id)) @@ -1020,7 +1020,7 @@ func (c *PetClient) GetX(ctx context.Context, id string) *Pet { func (c *PetClient) QueryTeam(pe *Pet) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := pe.id() t1 := sql.Table(user.Table) t2 := sql.Select(pet.TeamColumn). @@ -1039,7 +1039,7 @@ func (c *PetClient) QueryTeam(pe *Pet) *UserQuery { func (c *PetClient) QueryOwner(pe *Pet) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := pe.id() t1 := sql.Table(user.Table) t2 := sql.Select(pet.OwnerColumn). @@ -1122,7 +1122,7 @@ func (c *UserClient) GetX(ctx context.Context, id string) *User { func (c *UserClient) QueryCard(u *User) *CardQuery { query := &CardQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() query.sql = sql.Select().From(sql.Table(card.Table)). Where(sql.EQ(user.CardColumn, id)) @@ -1138,7 +1138,7 @@ func (c *UserClient) QueryCard(u *User) *CardQuery { func (c *UserClient) QueryPets(u *User) *PetQuery { query := &PetQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() query.sql = sql.Select().From(sql.Table(pet.Table)). Where(sql.EQ(user.PetsColumn, id)) @@ -1154,7 +1154,7 @@ func (c *UserClient) QueryPets(u *User) *PetQuery { func (c *UserClient) QueryFiles(u *User) *FileQuery { query := &FileQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() query.sql = sql.Select().From(sql.Table(file.Table)). Where(sql.EQ(user.FilesColumn, id)) @@ -1170,7 +1170,7 @@ func (c *UserClient) QueryFiles(u *User) *FileQuery { func (c *UserClient) QueryGroups(u *User) *GroupQuery { query := &GroupQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() t1 := sql.Table(group.Table) t2 := sql.Table(user.Table) @@ -1196,7 +1196,7 @@ func (c *UserClient) QueryGroups(u *User) *GroupQuery { func (c *UserClient) QueryFriends(u *User) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() t1 := sql.Table(user.Table) t2 := sql.Table(user.Table) @@ -1222,7 +1222,7 @@ func (c *UserClient) QueryFriends(u *User) *UserQuery { func (c *UserClient) QueryFollowers(u *User) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() t1 := sql.Table(user.Table) t2 := sql.Table(user.Table) @@ -1248,7 +1248,7 @@ func (c *UserClient) QueryFollowers(u *User) *UserQuery { func (c *UserClient) QueryFollowing(u *User) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() t1 := sql.Table(user.Table) t2 := sql.Table(user.Table) @@ -1274,7 +1274,7 @@ func (c *UserClient) QueryFollowing(u *User) *UserQuery { func (c *UserClient) QueryTeam(u *User) *PetQuery { query := &PetQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() query.sql = sql.Select().From(sql.Table(pet.Table)). Where(sql.EQ(user.TeamColumn, id)) @@ -1290,7 +1290,7 @@ func (c *UserClient) QueryTeam(u *User) *PetQuery { func (c *UserClient) QuerySpouse(u *User) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() query.sql = sql.Select().From(sql.Table(user.Table)). Where(sql.EQ(user.SpouseColumn, id)) @@ -1306,7 +1306,7 @@ func (c *UserClient) QuerySpouse(u *User) *UserQuery { func (c *UserClient) QueryChildren(u *User) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() query.sql = sql.Select().From(sql.Table(user.Table)). Where(sql.EQ(user.ChildrenColumn, id)) @@ -1322,7 +1322,7 @@ func (c *UserClient) QueryChildren(u *User) *UserQuery { func (c *UserClient) QueryParent(u *User) *UserQuery { query := &UserQuery{config: c.config} switch c.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: id := u.id() t1 := sql.Table(user.Table) t2 := sql.Select(user.ParentColumn). diff --git a/entc/integration/ent/comment_create.go b/entc/integration/ent/comment_create.go index 344458e60..7e57d1811 100644 --- a/entc/integration/ent/comment_create.go +++ b/entc/integration/ent/comment_create.go @@ -64,7 +64,7 @@ func (cc *CommentCreate) Save(ctx context.Context) (*Comment, error) { return nil, errors.New("ent: missing required field \"unique_float\"") } switch cc.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cc.sqlSave(ctx) case dialect.Gremlin: return cc.gremlinSave(ctx) diff --git a/entc/integration/ent/comment_delete.go b/entc/integration/ent/comment_delete.go index cd2d5a195..76bb5021c 100644 --- a/entc/integration/ent/comment_delete.go +++ b/entc/integration/ent/comment_delete.go @@ -35,7 +35,7 @@ func (cd *CommentDelete) Where(ps ...predicate.Comment) *CommentDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (cd *CommentDelete) Exec(ctx context.Context) (int, error) { switch cd.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cd.sqlExec(ctx) case dialect.Gremlin: return cd.gremlinExec(ctx) diff --git a/entc/integration/ent/comment_query.go b/entc/integration/ent/comment_query.go index 1e7e4321a..7fa682952 100644 --- a/entc/integration/ent/comment_query.go +++ b/entc/integration/ent/comment_query.go @@ -156,7 +156,7 @@ func (cq *CommentQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of Comments. func (cq *CommentQuery) All(ctx context.Context) ([]*Comment, error) { switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cq.sqlAll(ctx) case dialect.Gremlin: return cq.gremlinAll(ctx) @@ -195,7 +195,7 @@ func (cq *CommentQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (cq *CommentQuery) Count(ctx context.Context) (int, error) { switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cq.sqlCount(ctx) case dialect.Gremlin: return cq.gremlinCount(ctx) @@ -216,7 +216,7 @@ func (cq *CommentQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (cq *CommentQuery) Exist(ctx context.Context) (bool, error) { switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cq.sqlExist(ctx) case dialect.Gremlin: return cq.gremlinExist(ctx) @@ -269,7 +269,7 @@ func (cq *CommentQuery) GroupBy(field string, fields ...string) *CommentGroupBy group := &CommentGroupBy{config: cq.config} group.fields = append([]string{field}, fields...) switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = cq.sqlQuery() case dialect.Gremlin: group.gremlin = cq.gremlinQuery() @@ -293,7 +293,7 @@ func (cq *CommentQuery) Select(field string, fields ...string) *CommentSelect { selector := &CommentSelect{config: cq.config} selector.fields = append([]string{field}, fields...) switch cq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = cq.sqlQuery() case dialect.Gremlin: selector.gremlin = cq.gremlinQuery() @@ -454,7 +454,7 @@ func (cgb *CommentGroupBy) Aggregate(fns ...Aggregate) *CommentGroupBy { // Scan applies the group-by query and scan the result into the given value. func (cgb *CommentGroupBy) Scan(ctx context.Context, v interface{}) error { switch cgb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cgb.sqlScan(ctx, v) case dialect.Gremlin: return cgb.gremlinScan(ctx, v) @@ -623,7 +623,7 @@ type CommentSelect struct { // Scan applies the selector query and scan the result into the given value. func (cs *CommentSelect) Scan(ctx context.Context, v interface{}) error { switch cs.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cs.sqlScan(ctx, v) case dialect.Gremlin: return cs.gremlinScan(ctx, v) diff --git a/entc/integration/ent/comment_update.go b/entc/integration/ent/comment_update.go index 94555adf1..10976fe4f 100644 --- a/entc/integration/ent/comment_update.go +++ b/entc/integration/ent/comment_update.go @@ -110,7 +110,7 @@ func (cu *CommentUpdate) ClearNillableInt() *CommentUpdate { // Save executes the query and returns the number of rows/vertices matched by this operation. func (cu *CommentUpdate) Save(ctx context.Context) (int, error) { switch cu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cu.sqlSave(ctx) case dialect.Gremlin: return cu.gremlinSave(ctx) @@ -373,7 +373,7 @@ func (cuo *CommentUpdateOne) ClearNillableInt() *CommentUpdateOne { // Save executes the query and returns the updated entity. func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error) { switch cuo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return cuo.sqlSave(ctx) case dialect.Gremlin: return cuo.gremlinSave(ctx) diff --git a/entc/integration/ent/fieldtype_create.go b/entc/integration/ent/fieldtype_create.go index 2da8cfbe2..0096ddfdd 100644 --- a/entc/integration/ent/fieldtype_create.go +++ b/entc/integration/ent/fieldtype_create.go @@ -268,7 +268,7 @@ func (ftc *FieldTypeCreate) Save(ctx context.Context) (*FieldType, error) { } } switch ftc.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftc.sqlSave(ctx) case dialect.Gremlin: return ftc.gremlinSave(ctx) diff --git a/entc/integration/ent/fieldtype_delete.go b/entc/integration/ent/fieldtype_delete.go index 8b8d6cd7a..be0cd1aa3 100644 --- a/entc/integration/ent/fieldtype_delete.go +++ b/entc/integration/ent/fieldtype_delete.go @@ -35,7 +35,7 @@ func (ftd *FieldTypeDelete) Where(ps ...predicate.FieldType) *FieldTypeDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (ftd *FieldTypeDelete) Exec(ctx context.Context) (int, error) { switch ftd.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftd.sqlExec(ctx) case dialect.Gremlin: return ftd.gremlinExec(ctx) diff --git a/entc/integration/ent/fieldtype_query.go b/entc/integration/ent/fieldtype_query.go index 0dcd398d3..d93bb15b5 100644 --- a/entc/integration/ent/fieldtype_query.go +++ b/entc/integration/ent/fieldtype_query.go @@ -156,7 +156,7 @@ func (ftq *FieldTypeQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of FieldTypes. func (ftq *FieldTypeQuery) All(ctx context.Context) ([]*FieldType, error) { switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftq.sqlAll(ctx) case dialect.Gremlin: return ftq.gremlinAll(ctx) @@ -195,7 +195,7 @@ func (ftq *FieldTypeQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (ftq *FieldTypeQuery) Count(ctx context.Context) (int, error) { switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftq.sqlCount(ctx) case dialect.Gremlin: return ftq.gremlinCount(ctx) @@ -216,7 +216,7 @@ func (ftq *FieldTypeQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (ftq *FieldTypeQuery) Exist(ctx context.Context) (bool, error) { switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftq.sqlExist(ctx) case dialect.Gremlin: return ftq.gremlinExist(ctx) @@ -269,7 +269,7 @@ func (ftq *FieldTypeQuery) GroupBy(field string, fields ...string) *FieldTypeGro group := &FieldTypeGroupBy{config: ftq.config} group.fields = append([]string{field}, fields...) switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = ftq.sqlQuery() case dialect.Gremlin: group.gremlin = ftq.gremlinQuery() @@ -293,7 +293,7 @@ func (ftq *FieldTypeQuery) Select(field string, fields ...string) *FieldTypeSele selector := &FieldTypeSelect{config: ftq.config} selector.fields = append([]string{field}, fields...) switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = ftq.sqlQuery() case dialect.Gremlin: selector.gremlin = ftq.gremlinQuery() @@ -454,7 +454,7 @@ func (ftgb *FieldTypeGroupBy) Aggregate(fns ...Aggregate) *FieldTypeGroupBy { // Scan applies the group-by query and scan the result into the given value. func (ftgb *FieldTypeGroupBy) Scan(ctx context.Context, v interface{}) error { switch ftgb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftgb.sqlScan(ctx, v) case dialect.Gremlin: return ftgb.gremlinScan(ctx, v) @@ -623,7 +623,7 @@ type FieldTypeSelect struct { // Scan applies the selector query and scan the result into the given value. func (fts *FieldTypeSelect) Scan(ctx context.Context, v interface{}) error { switch fts.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fts.sqlScan(ctx, v) case dialect.Gremlin: return fts.gremlinScan(ctx, v) diff --git a/entc/integration/ent/fieldtype_update.go b/entc/integration/ent/fieldtype_update.go index 5907eed3c..38c3d62d8 100644 --- a/entc/integration/ent/fieldtype_update.go +++ b/entc/integration/ent/fieldtype_update.go @@ -549,7 +549,7 @@ func (ftu *FieldTypeUpdate) Save(ctx context.Context) (int, error) { } } switch ftu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftu.sqlSave(ctx) case dialect.Gremlin: return ftu.gremlinSave(ctx) @@ -1444,7 +1444,7 @@ func (ftuo *FieldTypeUpdateOne) Save(ctx context.Context) (*FieldType, error) { } } switch ftuo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftuo.sqlSave(ctx) case dialect.Gremlin: return ftuo.gremlinSave(ctx) diff --git a/entc/integration/ent/file_create.go b/entc/integration/ent/file_create.go index 793871b1f..a4e7e234b 100644 --- a/entc/integration/ent/file_create.go +++ b/entc/integration/ent/file_create.go @@ -144,7 +144,7 @@ func (fc *FileCreate) Save(ctx context.Context) (*File, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"type\"") } switch fc.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fc.sqlSave(ctx) case dialect.Gremlin: return fc.gremlinSave(ctx) diff --git a/entc/integration/ent/file_delete.go b/entc/integration/ent/file_delete.go index 157ef2f18..ae2f8c886 100644 --- a/entc/integration/ent/file_delete.go +++ b/entc/integration/ent/file_delete.go @@ -35,7 +35,7 @@ func (fd *FileDelete) Where(ps ...predicate.File) *FileDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (fd *FileDelete) Exec(ctx context.Context) (int, error) { switch fd.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fd.sqlExec(ctx) case dialect.Gremlin: return fd.gremlinExec(ctx) diff --git a/entc/integration/ent/file_query.go b/entc/integration/ent/file_query.go index 1cd133d4f..22316736e 100644 --- a/entc/integration/ent/file_query.go +++ b/entc/integration/ent/file_query.go @@ -65,7 +65,7 @@ func (fq *FileQuery) Order(o ...Order) *FileQuery { func (fq *FileQuery) QueryOwner() *UserQuery { query := &UserQuery{config: fq.config} switch fq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := fq.sqlQuery() t2.Select(t2.C(file.OwnerColumn)) @@ -84,7 +84,7 @@ func (fq *FileQuery) QueryOwner() *UserQuery { func (fq *FileQuery) QueryType() *FileTypeQuery { query := &FileTypeQuery{config: fq.config} switch fq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(filetype.Table) t2 := fq.sqlQuery() t2.Select(t2.C(file.TypeColumn)) @@ -196,7 +196,7 @@ func (fq *FileQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of Files. func (fq *FileQuery) All(ctx context.Context) ([]*File, error) { switch fq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fq.sqlAll(ctx) case dialect.Gremlin: return fq.gremlinAll(ctx) @@ -235,7 +235,7 @@ func (fq *FileQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (fq *FileQuery) Count(ctx context.Context) (int, error) { switch fq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fq.sqlCount(ctx) case dialect.Gremlin: return fq.gremlinCount(ctx) @@ -256,7 +256,7 @@ func (fq *FileQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (fq *FileQuery) Exist(ctx context.Context) (bool, error) { switch fq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fq.sqlExist(ctx) case dialect.Gremlin: return fq.gremlinExist(ctx) @@ -309,7 +309,7 @@ func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy { group := &FileGroupBy{config: fq.config} group.fields = append([]string{field}, fields...) switch fq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = fq.sqlQuery() case dialect.Gremlin: group.gremlin = fq.gremlinQuery() @@ -333,7 +333,7 @@ func (fq *FileQuery) Select(field string, fields ...string) *FileSelect { selector := &FileSelect{config: fq.config} selector.fields = append([]string{field}, fields...) switch fq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = fq.sqlQuery() case dialect.Gremlin: selector.gremlin = fq.gremlinQuery() @@ -494,7 +494,7 @@ func (fgb *FileGroupBy) Aggregate(fns ...Aggregate) *FileGroupBy { // Scan applies the group-by query and scan the result into the given value. func (fgb *FileGroupBy) Scan(ctx context.Context, v interface{}) error { switch fgb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fgb.sqlScan(ctx, v) case dialect.Gremlin: return fgb.gremlinScan(ctx, v) @@ -663,7 +663,7 @@ type FileSelect struct { // Scan applies the selector query and scan the result into the given value. func (fs *FileSelect) Scan(ctx context.Context, v interface{}) error { switch fs.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fs.sqlScan(ctx, v) case dialect.Gremlin: return fs.gremlinScan(ctx, v) diff --git a/entc/integration/ent/file_update.go b/entc/integration/ent/file_update.go index 07edb8a6f..831a4d952 100644 --- a/entc/integration/ent/file_update.go +++ b/entc/integration/ent/file_update.go @@ -190,7 +190,7 @@ func (fu *FileUpdate) Save(ctx context.Context) (int, error) { return 0, errors.New("ent: multiple assignments on a unique edge \"type\"") } switch fu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fu.sqlSave(ctx) case dialect.Gremlin: return fu.gremlinSave(ctx) @@ -562,7 +562,7 @@ func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"type\"") } switch fuo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fuo.sqlSave(ctx) case dialect.Gremlin: return fuo.gremlinSave(ctx) diff --git a/entc/integration/ent/filetype_create.go b/entc/integration/ent/filetype_create.go index 6cdf09347..45bd92a2c 100644 --- a/entc/integration/ent/filetype_create.go +++ b/entc/integration/ent/filetype_create.go @@ -62,7 +62,7 @@ func (ftc *FileTypeCreate) Save(ctx context.Context) (*FileType, error) { return nil, errors.New("ent: missing required field \"name\"") } switch ftc.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftc.sqlSave(ctx) case dialect.Gremlin: return ftc.gremlinSave(ctx) diff --git a/entc/integration/ent/filetype_delete.go b/entc/integration/ent/filetype_delete.go index d1e44ecc3..8413cfdaf 100644 --- a/entc/integration/ent/filetype_delete.go +++ b/entc/integration/ent/filetype_delete.go @@ -35,7 +35,7 @@ func (ftd *FileTypeDelete) Where(ps ...predicate.FileType) *FileTypeDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (ftd *FileTypeDelete) Exec(ctx context.Context) (int, error) { switch ftd.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftd.sqlExec(ctx) case dialect.Gremlin: return ftd.gremlinExec(ctx) diff --git a/entc/integration/ent/filetype_query.go b/entc/integration/ent/filetype_query.go index 744fa6cc1..e20f94aa9 100644 --- a/entc/integration/ent/filetype_query.go +++ b/entc/integration/ent/filetype_query.go @@ -64,7 +64,7 @@ func (ftq *FileTypeQuery) Order(o ...Order) *FileTypeQuery { func (ftq *FileTypeQuery) QueryFiles() *FileQuery { query := &FileQuery{config: ftq.config} switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(file.Table) t2 := ftq.sqlQuery() t2.Select(t2.C(filetype.FieldID)) @@ -176,7 +176,7 @@ func (ftq *FileTypeQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of FileTypes. func (ftq *FileTypeQuery) All(ctx context.Context) ([]*FileType, error) { switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftq.sqlAll(ctx) case dialect.Gremlin: return ftq.gremlinAll(ctx) @@ -215,7 +215,7 @@ func (ftq *FileTypeQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (ftq *FileTypeQuery) Count(ctx context.Context) (int, error) { switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftq.sqlCount(ctx) case dialect.Gremlin: return ftq.gremlinCount(ctx) @@ -236,7 +236,7 @@ func (ftq *FileTypeQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (ftq *FileTypeQuery) Exist(ctx context.Context) (bool, error) { switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftq.sqlExist(ctx) case dialect.Gremlin: return ftq.gremlinExist(ctx) @@ -289,7 +289,7 @@ func (ftq *FileTypeQuery) GroupBy(field string, fields ...string) *FileTypeGroup group := &FileTypeGroupBy{config: ftq.config} group.fields = append([]string{field}, fields...) switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = ftq.sqlQuery() case dialect.Gremlin: group.gremlin = ftq.gremlinQuery() @@ -313,7 +313,7 @@ func (ftq *FileTypeQuery) Select(field string, fields ...string) *FileTypeSelect selector := &FileTypeSelect{config: ftq.config} selector.fields = append([]string{field}, fields...) switch ftq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = ftq.sqlQuery() case dialect.Gremlin: selector.gremlin = ftq.gremlinQuery() @@ -474,7 +474,7 @@ func (ftgb *FileTypeGroupBy) Aggregate(fns ...Aggregate) *FileTypeGroupBy { // Scan applies the group-by query and scan the result into the given value. func (ftgb *FileTypeGroupBy) Scan(ctx context.Context, v interface{}) error { switch ftgb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftgb.sqlScan(ctx, v) case dialect.Gremlin: return ftgb.gremlinScan(ctx, v) @@ -643,7 +643,7 @@ type FileTypeSelect struct { // Scan applies the selector query and scan the result into the given value. func (fts *FileTypeSelect) Scan(ctx context.Context, v interface{}) error { switch fts.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return fts.sqlScan(ctx, v) case dialect.Gremlin: return fts.gremlinScan(ctx, v) diff --git a/entc/integration/ent/filetype_update.go b/entc/integration/ent/filetype_update.go index a8a8c759a..861476f73 100644 --- a/entc/integration/ent/filetype_update.go +++ b/entc/integration/ent/filetype_update.go @@ -88,7 +88,7 @@ func (ftu *FileTypeUpdate) RemoveFiles(f ...*File) *FileTypeUpdate { // Save executes the query and returns the number of rows/vertices matched by this operation. func (ftu *FileTypeUpdate) Save(ctx context.Context) (int, error) { switch ftu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftu.sqlSave(ctx) case dialect.Gremlin: return ftu.gremlinSave(ctx) @@ -330,7 +330,7 @@ func (ftuo *FileTypeUpdateOne) RemoveFiles(f ...*File) *FileTypeUpdateOne { // Save executes the query and returns the updated entity. func (ftuo *FileTypeUpdateOne) Save(ctx context.Context) (*FileType, error) { switch ftuo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ftuo.sqlSave(ctx) case dialect.Gremlin: return ftuo.gremlinSave(ctx) diff --git a/entc/integration/ent/group_create.go b/entc/integration/ent/group_create.go index d4831cd8a..4757279a5 100644 --- a/entc/integration/ent/group_create.go +++ b/entc/integration/ent/group_create.go @@ -201,7 +201,7 @@ func (gc *GroupCreate) Save(ctx context.Context) (*Group, error) { return nil, errors.New("ent: missing required edge \"info\"") } switch gc.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gc.sqlSave(ctx) case dialect.Gremlin: return gc.gremlinSave(ctx) diff --git a/entc/integration/ent/group_delete.go b/entc/integration/ent/group_delete.go index e5934019e..2d8600eb0 100644 --- a/entc/integration/ent/group_delete.go +++ b/entc/integration/ent/group_delete.go @@ -35,7 +35,7 @@ func (gd *GroupDelete) Where(ps ...predicate.Group) *GroupDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (gd *GroupDelete) Exec(ctx context.Context) (int, error) { switch gd.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gd.sqlExec(ctx) case dialect.Gremlin: return gd.gremlinExec(ctx) diff --git a/entc/integration/ent/group_query.go b/entc/integration/ent/group_query.go index 111231a59..d27099a4a 100644 --- a/entc/integration/ent/group_query.go +++ b/entc/integration/ent/group_query.go @@ -66,7 +66,7 @@ func (gq *GroupQuery) Order(o ...Order) *GroupQuery { func (gq *GroupQuery) QueryFiles() *FileQuery { query := &FileQuery{config: gq.config} switch gq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(file.Table) t2 := gq.sqlQuery() t2.Select(t2.C(group.FieldID)) @@ -85,7 +85,7 @@ func (gq *GroupQuery) QueryFiles() *FileQuery { func (gq *GroupQuery) QueryBlocked() *UserQuery { query := &UserQuery{config: gq.config} switch gq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := gq.sqlQuery() t2.Select(t2.C(group.FieldID)) @@ -104,7 +104,7 @@ func (gq *GroupQuery) QueryBlocked() *UserQuery { func (gq *GroupQuery) QueryUsers() *UserQuery { query := &UserQuery{config: gq.config} switch gq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := gq.sqlQuery() t2.Select(t2.C(group.FieldID)) @@ -128,7 +128,7 @@ func (gq *GroupQuery) QueryUsers() *UserQuery { func (gq *GroupQuery) QueryInfo() *GroupInfoQuery { query := &GroupInfoQuery{config: gq.config} switch gq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(groupinfo.Table) t2 := gq.sqlQuery() t2.Select(t2.C(group.InfoColumn)) @@ -240,7 +240,7 @@ func (gq *GroupQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of Groups. func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) { switch gq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gq.sqlAll(ctx) case dialect.Gremlin: return gq.gremlinAll(ctx) @@ -279,7 +279,7 @@ func (gq *GroupQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (gq *GroupQuery) Count(ctx context.Context) (int, error) { switch gq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gq.sqlCount(ctx) case dialect.Gremlin: return gq.gremlinCount(ctx) @@ -300,7 +300,7 @@ func (gq *GroupQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (gq *GroupQuery) Exist(ctx context.Context) (bool, error) { switch gq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gq.sqlExist(ctx) case dialect.Gremlin: return gq.gremlinExist(ctx) @@ -353,7 +353,7 @@ func (gq *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy { group := &GroupGroupBy{config: gq.config} group.fields = append([]string{field}, fields...) switch gq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = gq.sqlQuery() case dialect.Gremlin: group.gremlin = gq.gremlinQuery() @@ -377,7 +377,7 @@ func (gq *GroupQuery) Select(field string, fields ...string) *GroupSelect { selector := &GroupSelect{config: gq.config} selector.fields = append([]string{field}, fields...) switch gq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = gq.sqlQuery() case dialect.Gremlin: selector.gremlin = gq.gremlinQuery() @@ -538,7 +538,7 @@ func (ggb *GroupGroupBy) Aggregate(fns ...Aggregate) *GroupGroupBy { // Scan applies the group-by query and scan the result into the given value. func (ggb *GroupGroupBy) Scan(ctx context.Context, v interface{}) error { switch ggb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ggb.sqlScan(ctx, v) case dialect.Gremlin: return ggb.gremlinScan(ctx, v) @@ -707,7 +707,7 @@ type GroupSelect struct { // Scan applies the selector query and scan the result into the given value. func (gs *GroupSelect) Scan(ctx context.Context, v interface{}) error { switch gs.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gs.sqlScan(ctx, v) case dialect.Gremlin: return gs.gremlinScan(ctx, v) diff --git a/entc/integration/ent/group_update.go b/entc/integration/ent/group_update.go index 3b2da0db6..d03157090 100644 --- a/entc/integration/ent/group_update.go +++ b/entc/integration/ent/group_update.go @@ -298,7 +298,7 @@ func (gu *GroupUpdate) Save(ctx context.Context) (int, error) { return 0, errors.New("ent: clearing a unique edge \"info\"") } switch gu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gu.sqlSave(ctx) case dialect.Gremlin: return gu.gremlinSave(ctx) @@ -925,7 +925,7 @@ func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { return nil, errors.New("ent: clearing a unique edge \"info\"") } switch guo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return guo.sqlSave(ctx) case dialect.Gremlin: return guo.gremlinSave(ctx) diff --git a/entc/integration/ent/groupinfo_create.go b/entc/integration/ent/groupinfo_create.go index d9078ac22..393e6ca61 100644 --- a/entc/integration/ent/groupinfo_create.go +++ b/entc/integration/ent/groupinfo_create.go @@ -81,7 +81,7 @@ func (gic *GroupInfoCreate) Save(ctx context.Context) (*GroupInfo, error) { gic.max_users = &v } switch gic.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gic.sqlSave(ctx) case dialect.Gremlin: return gic.gremlinSave(ctx) diff --git a/entc/integration/ent/groupinfo_delete.go b/entc/integration/ent/groupinfo_delete.go index dd81f8aad..5950e1f93 100644 --- a/entc/integration/ent/groupinfo_delete.go +++ b/entc/integration/ent/groupinfo_delete.go @@ -35,7 +35,7 @@ func (gid *GroupInfoDelete) Where(ps ...predicate.GroupInfo) *GroupInfoDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (gid *GroupInfoDelete) Exec(ctx context.Context) (int, error) { switch gid.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gid.sqlExec(ctx) case dialect.Gremlin: return gid.gremlinExec(ctx) diff --git a/entc/integration/ent/groupinfo_query.go b/entc/integration/ent/groupinfo_query.go index b451237a2..781947a23 100644 --- a/entc/integration/ent/groupinfo_query.go +++ b/entc/integration/ent/groupinfo_query.go @@ -64,7 +64,7 @@ func (giq *GroupInfoQuery) Order(o ...Order) *GroupInfoQuery { func (giq *GroupInfoQuery) QueryGroups() *GroupQuery { query := &GroupQuery{config: giq.config} switch giq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(group.Table) t2 := giq.sqlQuery() t2.Select(t2.C(groupinfo.FieldID)) @@ -176,7 +176,7 @@ func (giq *GroupInfoQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of GroupInfos. func (giq *GroupInfoQuery) All(ctx context.Context) ([]*GroupInfo, error) { switch giq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return giq.sqlAll(ctx) case dialect.Gremlin: return giq.gremlinAll(ctx) @@ -215,7 +215,7 @@ func (giq *GroupInfoQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (giq *GroupInfoQuery) Count(ctx context.Context) (int, error) { switch giq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return giq.sqlCount(ctx) case dialect.Gremlin: return giq.gremlinCount(ctx) @@ -236,7 +236,7 @@ func (giq *GroupInfoQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (giq *GroupInfoQuery) Exist(ctx context.Context) (bool, error) { switch giq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return giq.sqlExist(ctx) case dialect.Gremlin: return giq.gremlinExist(ctx) @@ -289,7 +289,7 @@ func (giq *GroupInfoQuery) GroupBy(field string, fields ...string) *GroupInfoGro group := &GroupInfoGroupBy{config: giq.config} group.fields = append([]string{field}, fields...) switch giq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = giq.sqlQuery() case dialect.Gremlin: group.gremlin = giq.gremlinQuery() @@ -313,7 +313,7 @@ func (giq *GroupInfoQuery) Select(field string, fields ...string) *GroupInfoSele selector := &GroupInfoSelect{config: giq.config} selector.fields = append([]string{field}, fields...) switch giq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = giq.sqlQuery() case dialect.Gremlin: selector.gremlin = giq.gremlinQuery() @@ -474,7 +474,7 @@ func (gigb *GroupInfoGroupBy) Aggregate(fns ...Aggregate) *GroupInfoGroupBy { // Scan applies the group-by query and scan the result into the given value. func (gigb *GroupInfoGroupBy) Scan(ctx context.Context, v interface{}) error { switch gigb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gigb.sqlScan(ctx, v) case dialect.Gremlin: return gigb.gremlinScan(ctx, v) @@ -643,7 +643,7 @@ type GroupInfoSelect struct { // Scan applies the selector query and scan the result into the given value. func (gis *GroupInfoSelect) Scan(ctx context.Context, v interface{}) error { switch gis.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return gis.sqlScan(ctx, v) case dialect.Gremlin: return gis.gremlinScan(ctx, v) diff --git a/entc/integration/ent/groupinfo_update.go b/entc/integration/ent/groupinfo_update.go index dbc5f64b0..86b414ee2 100644 --- a/entc/integration/ent/groupinfo_update.go +++ b/entc/integration/ent/groupinfo_update.go @@ -115,7 +115,7 @@ func (giu *GroupInfoUpdate) RemoveGroups(g ...*Group) *GroupInfoUpdate { // Save executes the query and returns the number of rows/vertices matched by this operation. func (giu *GroupInfoUpdate) Save(ctx context.Context) (int, error) { switch giu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return giu.sqlSave(ctx) case dialect.Gremlin: return giu.gremlinSave(ctx) @@ -392,7 +392,7 @@ func (giuo *GroupInfoUpdateOne) RemoveGroups(g ...*Group) *GroupInfoUpdateOne { // Save executes the query and returns the updated entity. func (giuo *GroupInfoUpdateOne) Save(ctx context.Context) (*GroupInfo, error) { switch giuo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return giuo.sqlSave(ctx) case dialect.Gremlin: return giuo.gremlinSave(ctx) diff --git a/entc/integration/ent/item_create.go b/entc/integration/ent/item_create.go index e85ea4aee..9fa19a40b 100644 --- a/entc/integration/ent/item_create.go +++ b/entc/integration/ent/item_create.go @@ -27,7 +27,7 @@ type ItemCreate struct { // Save creates the Item in the database. func (ic *ItemCreate) Save(ctx context.Context) (*Item, error) { switch ic.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ic.sqlSave(ctx) case dialect.Gremlin: return ic.gremlinSave(ctx) diff --git a/entc/integration/ent/item_delete.go b/entc/integration/ent/item_delete.go index a24f1c267..a2a03890a 100644 --- a/entc/integration/ent/item_delete.go +++ b/entc/integration/ent/item_delete.go @@ -35,7 +35,7 @@ func (id *ItemDelete) Where(ps ...predicate.Item) *ItemDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (id *ItemDelete) Exec(ctx context.Context) (int, error) { switch id.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return id.sqlExec(ctx) case dialect.Gremlin: return id.gremlinExec(ctx) diff --git a/entc/integration/ent/item_query.go b/entc/integration/ent/item_query.go index 0f16c64d6..0671f0b92 100644 --- a/entc/integration/ent/item_query.go +++ b/entc/integration/ent/item_query.go @@ -156,7 +156,7 @@ func (iq *ItemQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of Items. func (iq *ItemQuery) All(ctx context.Context) ([]*Item, error) { switch iq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return iq.sqlAll(ctx) case dialect.Gremlin: return iq.gremlinAll(ctx) @@ -195,7 +195,7 @@ func (iq *ItemQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (iq *ItemQuery) Count(ctx context.Context) (int, error) { switch iq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return iq.sqlCount(ctx) case dialect.Gremlin: return iq.gremlinCount(ctx) @@ -216,7 +216,7 @@ func (iq *ItemQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (iq *ItemQuery) Exist(ctx context.Context) (bool, error) { switch iq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return iq.sqlExist(ctx) case dialect.Gremlin: return iq.gremlinExist(ctx) @@ -256,7 +256,7 @@ func (iq *ItemQuery) GroupBy(field string, fields ...string) *ItemGroupBy { group := &ItemGroupBy{config: iq.config} group.fields = append([]string{field}, fields...) switch iq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = iq.sqlQuery() case dialect.Gremlin: group.gremlin = iq.gremlinQuery() @@ -269,7 +269,7 @@ func (iq *ItemQuery) Select(field string, fields ...string) *ItemSelect { selector := &ItemSelect{config: iq.config} selector.fields = append([]string{field}, fields...) switch iq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = iq.sqlQuery() case dialect.Gremlin: selector.gremlin = iq.gremlinQuery() @@ -430,7 +430,7 @@ func (igb *ItemGroupBy) Aggregate(fns ...Aggregate) *ItemGroupBy { // Scan applies the group-by query and scan the result into the given value. func (igb *ItemGroupBy) Scan(ctx context.Context, v interface{}) error { switch igb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return igb.sqlScan(ctx, v) case dialect.Gremlin: return igb.gremlinScan(ctx, v) @@ -599,7 +599,7 @@ type ItemSelect struct { // Scan applies the selector query and scan the result into the given value. func (is *ItemSelect) Scan(ctx context.Context, v interface{}) error { switch is.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return is.sqlScan(ctx, v) case dialect.Gremlin: return is.gremlinScan(ctx, v) diff --git a/entc/integration/ent/item_update.go b/entc/integration/ent/item_update.go index 2a5e220fd..c83d35655 100644 --- a/entc/integration/ent/item_update.go +++ b/entc/integration/ent/item_update.go @@ -35,7 +35,7 @@ func (iu *ItemUpdate) Where(ps ...predicate.Item) *ItemUpdate { // Save executes the query and returns the number of rows/vertices matched by this operation. func (iu *ItemUpdate) Save(ctx context.Context) (int, error) { switch iu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return iu.sqlSave(ctx) case dialect.Gremlin: return iu.gremlinSave(ctx) @@ -133,7 +133,7 @@ type ItemUpdateOne struct { // Save executes the query and returns the updated entity. func (iuo *ItemUpdateOne) Save(ctx context.Context) (*Item, error) { switch iuo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return iuo.sqlSave(ctx) case dialect.Gremlin: return iuo.gremlinSave(ctx) diff --git a/entc/integration/ent/node_create.go b/entc/integration/ent/node_create.go index 042ad79b2..4033ed201 100644 --- a/entc/integration/ent/node_create.go +++ b/entc/integration/ent/node_create.go @@ -97,7 +97,7 @@ func (nc *NodeCreate) Save(ctx context.Context) (*Node, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"next\"") } switch nc.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return nc.sqlSave(ctx) case dialect.Gremlin: return nc.gremlinSave(ctx) diff --git a/entc/integration/ent/node_delete.go b/entc/integration/ent/node_delete.go index 95e20f89a..c5d3c6f73 100644 --- a/entc/integration/ent/node_delete.go +++ b/entc/integration/ent/node_delete.go @@ -35,7 +35,7 @@ func (nd *NodeDelete) Where(ps ...predicate.Node) *NodeDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (nd *NodeDelete) Exec(ctx context.Context) (int, error) { switch nd.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return nd.sqlExec(ctx) case dialect.Gremlin: return nd.gremlinExec(ctx) diff --git a/entc/integration/ent/node_query.go b/entc/integration/ent/node_query.go index 1d8956bf8..5d309167b 100644 --- a/entc/integration/ent/node_query.go +++ b/entc/integration/ent/node_query.go @@ -63,7 +63,7 @@ func (nq *NodeQuery) Order(o ...Order) *NodeQuery { func (nq *NodeQuery) QueryPrev() *NodeQuery { query := &NodeQuery{config: nq.config} switch nq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(node.Table) t2 := nq.sqlQuery() t2.Select(t2.C(node.PrevColumn)) @@ -82,7 +82,7 @@ func (nq *NodeQuery) QueryPrev() *NodeQuery { func (nq *NodeQuery) QueryNext() *NodeQuery { query := &NodeQuery{config: nq.config} switch nq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(node.Table) t2 := nq.sqlQuery() t2.Select(t2.C(node.FieldID)) @@ -194,7 +194,7 @@ func (nq *NodeQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of Nodes. func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error) { switch nq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return nq.sqlAll(ctx) case dialect.Gremlin: return nq.gremlinAll(ctx) @@ -233,7 +233,7 @@ func (nq *NodeQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (nq *NodeQuery) Count(ctx context.Context) (int, error) { switch nq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return nq.sqlCount(ctx) case dialect.Gremlin: return nq.gremlinCount(ctx) @@ -254,7 +254,7 @@ func (nq *NodeQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (nq *NodeQuery) Exist(ctx context.Context) (bool, error) { switch nq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return nq.sqlExist(ctx) case dialect.Gremlin: return nq.gremlinExist(ctx) @@ -307,7 +307,7 @@ func (nq *NodeQuery) GroupBy(field string, fields ...string) *NodeGroupBy { group := &NodeGroupBy{config: nq.config} group.fields = append([]string{field}, fields...) switch nq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = nq.sqlQuery() case dialect.Gremlin: group.gremlin = nq.gremlinQuery() @@ -331,7 +331,7 @@ func (nq *NodeQuery) Select(field string, fields ...string) *NodeSelect { selector := &NodeSelect{config: nq.config} selector.fields = append([]string{field}, fields...) switch nq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = nq.sqlQuery() case dialect.Gremlin: selector.gremlin = nq.gremlinQuery() @@ -492,7 +492,7 @@ func (ngb *NodeGroupBy) Aggregate(fns ...Aggregate) *NodeGroupBy { // Scan applies the group-by query and scan the result into the given value. func (ngb *NodeGroupBy) Scan(ctx context.Context, v interface{}) error { switch ngb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ngb.sqlScan(ctx, v) case dialect.Gremlin: return ngb.gremlinScan(ctx, v) @@ -661,7 +661,7 @@ type NodeSelect struct { // Scan applies the selector query and scan the result into the given value. func (ns *NodeSelect) Scan(ctx context.Context, v interface{}) error { switch ns.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ns.sqlScan(ctx, v) case dialect.Gremlin: return ns.gremlinScan(ctx, v) diff --git a/entc/integration/ent/node_update.go b/entc/integration/ent/node_update.go index bf2ae0089..47d167226 100644 --- a/entc/integration/ent/node_update.go +++ b/entc/integration/ent/node_update.go @@ -139,7 +139,7 @@ func (nu *NodeUpdate) Save(ctx context.Context) (int, error) { return 0, errors.New("ent: multiple assignments on a unique edge \"next\"") } switch nu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return nu.sqlSave(ctx) case dialect.Gremlin: return nu.gremlinSave(ctx) @@ -472,7 +472,7 @@ func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"next\"") } switch nuo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return nuo.sqlSave(ctx) case dialect.Gremlin: return nuo.gremlinSave(ctx) diff --git a/entc/integration/ent/pet_create.go b/entc/integration/ent/pet_create.go index db1ae62d9..8410fa062 100644 --- a/entc/integration/ent/pet_create.go +++ b/entc/integration/ent/pet_create.go @@ -93,7 +93,7 @@ func (pc *PetCreate) Save(ctx context.Context) (*Pet, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"owner\"") } switch pc.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return pc.sqlSave(ctx) case dialect.Gremlin: return pc.gremlinSave(ctx) diff --git a/entc/integration/ent/pet_delete.go b/entc/integration/ent/pet_delete.go index 23826c188..b007bdda8 100644 --- a/entc/integration/ent/pet_delete.go +++ b/entc/integration/ent/pet_delete.go @@ -35,7 +35,7 @@ func (pd *PetDelete) Where(ps ...predicate.Pet) *PetDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (pd *PetDelete) Exec(ctx context.Context) (int, error) { switch pd.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return pd.sqlExec(ctx) case dialect.Gremlin: return pd.gremlinExec(ctx) diff --git a/entc/integration/ent/pet_query.go b/entc/integration/ent/pet_query.go index e2d441ffd..235e1bd1b 100644 --- a/entc/integration/ent/pet_query.go +++ b/entc/integration/ent/pet_query.go @@ -64,7 +64,7 @@ func (pq *PetQuery) Order(o ...Order) *PetQuery { func (pq *PetQuery) QueryTeam() *UserQuery { query := &UserQuery{config: pq.config} switch pq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := pq.sqlQuery() t2.Select(t2.C(pet.TeamColumn)) @@ -83,7 +83,7 @@ func (pq *PetQuery) QueryTeam() *UserQuery { func (pq *PetQuery) QueryOwner() *UserQuery { query := &UserQuery{config: pq.config} switch pq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := pq.sqlQuery() t2.Select(t2.C(pet.OwnerColumn)) @@ -195,7 +195,7 @@ func (pq *PetQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of Pets. func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error) { switch pq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return pq.sqlAll(ctx) case dialect.Gremlin: return pq.gremlinAll(ctx) @@ -234,7 +234,7 @@ func (pq *PetQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (pq *PetQuery) Count(ctx context.Context) (int, error) { switch pq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return pq.sqlCount(ctx) case dialect.Gremlin: return pq.gremlinCount(ctx) @@ -255,7 +255,7 @@ func (pq *PetQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (pq *PetQuery) Exist(ctx context.Context) (bool, error) { switch pq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return pq.sqlExist(ctx) case dialect.Gremlin: return pq.gremlinExist(ctx) @@ -308,7 +308,7 @@ func (pq *PetQuery) GroupBy(field string, fields ...string) *PetGroupBy { group := &PetGroupBy{config: pq.config} group.fields = append([]string{field}, fields...) switch pq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = pq.sqlQuery() case dialect.Gremlin: group.gremlin = pq.gremlinQuery() @@ -332,7 +332,7 @@ func (pq *PetQuery) Select(field string, fields ...string) *PetSelect { selector := &PetSelect{config: pq.config} selector.fields = append([]string{field}, fields...) switch pq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = pq.sqlQuery() case dialect.Gremlin: selector.gremlin = pq.gremlinQuery() @@ -493,7 +493,7 @@ func (pgb *PetGroupBy) Aggregate(fns ...Aggregate) *PetGroupBy { // Scan applies the group-by query and scan the result into the given value. func (pgb *PetGroupBy) Scan(ctx context.Context, v interface{}) error { switch pgb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return pgb.sqlScan(ctx, v) case dialect.Gremlin: return pgb.gremlinScan(ctx, v) @@ -662,7 +662,7 @@ type PetSelect struct { // Scan applies the selector query and scan the result into the given value. func (ps *PetSelect) Scan(ctx context.Context, v interface{}) error { switch ps.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ps.sqlScan(ctx, v) case dialect.Gremlin: return ps.gremlinScan(ctx, v) diff --git a/entc/integration/ent/pet_update.go b/entc/integration/ent/pet_update.go index 3aef24be1..a9e413a51 100644 --- a/entc/integration/ent/pet_update.go +++ b/entc/integration/ent/pet_update.go @@ -112,7 +112,7 @@ func (pu *PetUpdate) Save(ctx context.Context) (int, error) { return 0, errors.New("ent: multiple assignments on a unique edge \"owner\"") } switch pu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return pu.sqlSave(ctx) case dialect.Gremlin: return pu.gremlinSave(ctx) @@ -391,7 +391,7 @@ func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"owner\"") } switch puo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return puo.sqlSave(ctx) case dialect.Gremlin: return puo.gremlinSave(ctx) diff --git a/entc/integration/ent/user_create.go b/entc/integration/ent/user_create.go index 7de8e9800..1b75f9285 100644 --- a/entc/integration/ent/user_create.go +++ b/entc/integration/ent/user_create.go @@ -368,7 +368,7 @@ func (uc *UserCreate) Save(ctx context.Context) (*User, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"parent\"") } switch uc.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return uc.sqlSave(ctx) case dialect.Gremlin: return uc.gremlinSave(ctx) diff --git a/entc/integration/ent/user_delete.go b/entc/integration/ent/user_delete.go index 4ef33d5ba..26cbc60f4 100644 --- a/entc/integration/ent/user_delete.go +++ b/entc/integration/ent/user_delete.go @@ -35,7 +35,7 @@ func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete { // Exec executes the deletion query and returns how many vertices were deleted. func (ud *UserDelete) Exec(ctx context.Context) (int, error) { switch ud.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ud.sqlExec(ctx) case dialect.Gremlin: return ud.gremlinExec(ctx) diff --git a/entc/integration/ent/user_query.go b/entc/integration/ent/user_query.go index 653d75818..22c4e728f 100644 --- a/entc/integration/ent/user_query.go +++ b/entc/integration/ent/user_query.go @@ -67,7 +67,7 @@ func (uq *UserQuery) Order(o ...Order) *UserQuery { func (uq *UserQuery) QueryCard() *CardQuery { query := &CardQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(card.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -86,7 +86,7 @@ func (uq *UserQuery) QueryCard() *CardQuery { func (uq *UserQuery) QueryPets() *PetQuery { query := &PetQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(pet.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -105,7 +105,7 @@ func (uq *UserQuery) QueryPets() *PetQuery { func (uq *UserQuery) QueryFiles() *FileQuery { query := &FileQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(file.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -124,7 +124,7 @@ func (uq *UserQuery) QueryFiles() *FileQuery { func (uq *UserQuery) QueryGroups() *GroupQuery { query := &GroupQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(group.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -148,7 +148,7 @@ func (uq *UserQuery) QueryGroups() *GroupQuery { func (uq *UserQuery) QueryFriends() *UserQuery { query := &UserQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -172,7 +172,7 @@ func (uq *UserQuery) QueryFriends() *UserQuery { func (uq *UserQuery) QueryFollowers() *UserQuery { query := &UserQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -196,7 +196,7 @@ func (uq *UserQuery) QueryFollowers() *UserQuery { func (uq *UserQuery) QueryFollowing() *UserQuery { query := &UserQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -220,7 +220,7 @@ func (uq *UserQuery) QueryFollowing() *UserQuery { func (uq *UserQuery) QueryTeam() *PetQuery { query := &PetQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(pet.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -239,7 +239,7 @@ func (uq *UserQuery) QueryTeam() *PetQuery { func (uq *UserQuery) QuerySpouse() *UserQuery { query := &UserQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -258,7 +258,7 @@ func (uq *UserQuery) QuerySpouse() *UserQuery { func (uq *UserQuery) QueryChildren() *UserQuery { query := &UserQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.FieldID)) @@ -277,7 +277,7 @@ func (uq *UserQuery) QueryChildren() *UserQuery { func (uq *UserQuery) QueryParent() *UserQuery { query := &UserQuery{config: uq.config} switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: t1 := sql.Table(user.Table) t2 := uq.sqlQuery() t2.Select(t2.C(user.ParentColumn)) @@ -389,7 +389,7 @@ func (uq *UserQuery) OnlyXID(ctx context.Context) string { // All executes the query and returns a list of Users. func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return uq.sqlAll(ctx) case dialect.Gremlin: return uq.gremlinAll(ctx) @@ -428,7 +428,7 @@ func (uq *UserQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (uq *UserQuery) Count(ctx context.Context) (int, error) { switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return uq.sqlCount(ctx) case dialect.Gremlin: return uq.gremlinCount(ctx) @@ -449,7 +449,7 @@ func (uq *UserQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (uq *UserQuery) Exist(ctx context.Context) (bool, error) { switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return uq.sqlExist(ctx) case dialect.Gremlin: return uq.gremlinExist(ctx) @@ -502,7 +502,7 @@ func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy { group := &UserGroupBy{config: uq.config} group.fields = append([]string{field}, fields...) switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: group.sql = uq.sqlQuery() case dialect.Gremlin: group.gremlin = uq.gremlinQuery() @@ -526,7 +526,7 @@ func (uq *UserQuery) Select(field string, fields ...string) *UserSelect { selector := &UserSelect{config: uq.config} selector.fields = append([]string{field}, fields...) switch uq.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: selector.sql = uq.sqlQuery() case dialect.Gremlin: selector.gremlin = uq.gremlinQuery() @@ -687,7 +687,7 @@ func (ugb *UserGroupBy) Aggregate(fns ...Aggregate) *UserGroupBy { // Scan applies the group-by query and scan the result into the given value. func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error { switch ugb.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return ugb.sqlScan(ctx, v) case dialect.Gremlin: return ugb.gremlinScan(ctx, v) @@ -856,7 +856,7 @@ type UserSelect struct { // Scan applies the selector query and scan the result into the given value. func (us *UserSelect) Scan(ctx context.Context, v interface{}) error { switch us.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return us.sqlScan(ctx, v) case dialect.Gremlin: return us.gremlinScan(ctx, v) diff --git a/entc/integration/ent/user_update.go b/entc/integration/ent/user_update.go index 8006d4bd0..d6ce12cf7 100644 --- a/entc/integration/ent/user_update.go +++ b/entc/integration/ent/user_update.go @@ -577,7 +577,7 @@ func (uu *UserUpdate) Save(ctx context.Context) (int, error) { return 0, errors.New("ent: multiple assignments on a unique edge \"parent\"") } switch uu.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return uu.sqlSave(ctx) case dialect.Gremlin: return uu.gremlinSave(ctx) @@ -1855,7 +1855,7 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { return nil, errors.New("ent: multiple assignments on a unique edge \"parent\"") } switch uuo.driver.Dialect() { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: return uuo.sqlSave(ctx) case dialect.Gremlin: return uuo.gremlinSave(ctx) diff --git a/entc/integration/idtype/ent/client.go b/entc/integration/idtype/ent/client.go index abc3d017a..e738fc05a 100644 --- a/entc/integration/idtype/ent/client.go +++ b/entc/integration/idtype/ent/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/entc/integration/json/ent/client.go b/entc/integration/json/ent/client.go index f26784b49..7dca19d05 100644 --- a/entc/integration/json/ent/client.go +++ b/entc/integration/json/ent/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/entc/integration/migrate/entv1/client.go b/entc/integration/migrate/entv1/client.go index e3b629b80..5caf15f95 100644 --- a/entc/integration/migrate/entv1/client.go +++ b/entc/integration/migrate/entv1/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/entc/integration/migrate/entv2/client.go b/entc/integration/migrate/entv2/client.go index 95f2ef4f8..6b0157361 100644 --- a/entc/integration/migrate/entv2/client.go +++ b/entc/integration/migrate/entv2/client.go @@ -52,7 +52,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/entc/integration/template/ent/client.go b/entc/integration/template/ent/client.go index 8f1098548..f7f633b03 100644 --- a/entc/integration/template/ent/client.go +++ b/entc/integration/template/ent/client.go @@ -52,7 +52,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/edgeindex/ent/client.go b/examples/edgeindex/ent/client.go index d416148f9..46f22a33c 100644 --- a/examples/edgeindex/ent/client.go +++ b/examples/edgeindex/ent/client.go @@ -48,7 +48,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/entcpkg/ent/client.go b/examples/entcpkg/ent/client.go index aace2c7f6..296fd3584 100644 --- a/examples/entcpkg/ent/client.go +++ b/examples/entcpkg/ent/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/m2m2types/ent/client.go b/examples/m2m2types/ent/client.go index c7968f1a4..1118e8ef8 100644 --- a/examples/m2m2types/ent/client.go +++ b/examples/m2m2types/ent/client.go @@ -48,7 +48,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/m2mbidi/ent/client.go b/examples/m2mbidi/ent/client.go index ce98b98ae..9e71df161 100644 --- a/examples/m2mbidi/ent/client.go +++ b/examples/m2mbidi/ent/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/m2mrecur/ent/client.go b/examples/m2mrecur/ent/client.go index a603c4fed..b7916b0f7 100644 --- a/examples/m2mrecur/ent/client.go +++ b/examples/m2mrecur/ent/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/o2m2types/ent/client.go b/examples/o2m2types/ent/client.go index 188e1b84a..8694950c8 100644 --- a/examples/o2m2types/ent/client.go +++ b/examples/o2m2types/ent/client.go @@ -48,7 +48,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/o2mrecur/ent/client.go b/examples/o2mrecur/ent/client.go index 4c3ffd531..25edd4a53 100644 --- a/examples/o2mrecur/ent/client.go +++ b/examples/o2mrecur/ent/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/o2o2types/ent/client.go b/examples/o2o2types/ent/client.go index 532660dbe..b81d79d07 100644 --- a/examples/o2o2types/ent/client.go +++ b/examples/o2o2types/ent/client.go @@ -48,7 +48,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/o2obidi/ent/client.go b/examples/o2obidi/ent/client.go index 8097076eb..37274f523 100644 --- a/examples/o2obidi/ent/client.go +++ b/examples/o2obidi/ent/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/o2orecur/ent/client.go b/examples/o2orecur/ent/client.go index 7ebd8e857..da6f488a3 100644 --- a/examples/o2orecur/ent/client.go +++ b/examples/o2orecur/ent/client.go @@ -44,7 +44,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/start/ent/client.go b/examples/start/ent/client.go index d753eed99..a7e8b060f 100644 --- a/examples/start/ent/client.go +++ b/examples/start/ent/client.go @@ -52,7 +52,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err diff --git a/examples/traversal/ent/client.go b/examples/traversal/ent/client.go index 1c48a9e94..372ace3d7 100644 --- a/examples/traversal/ent/client.go +++ b/examples/traversal/ent/client.go @@ -52,7 +52,7 @@ func NewClient(opts ...Option) *Client { // Optional parameters can be added for configuring the client. func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { - case dialect.MySQL, dialect.SQLite: + case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err