dialect/sql: change boolean operators wrapping (#678)

The reason is to parentheses only when it's necessary.
This commit is contained in:
Ariel Mashraki
2020-08-20 10:08:31 +03:00
committed by GitHub
parent ea97f3a6e0
commit b18716931d
9 changed files with 174 additions and 134 deletions

View File

@@ -36,7 +36,10 @@ func (d *SQLite) init(ctx context.Context, tx dialect.Tx) error {
func (d *SQLite) tableExist(ctx context.Context, tx dialect.Tx, name string) (bool, error) {
query, args := sql.Select().Count().
From(sql.Table("sqlite_master")).
Where(sql.EQ("type", "table").And().EQ("name", name)).
Where(sql.And(
sql.EQ("type", "table"),
sql.EQ("name", name),
)).
Query()
return exist(ctx, tx, query, args...)
}