You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. What version of Go and system type/arch are you using?
go1.20.3
2. What version of GoFrame are you using?
v2.4.0
3. Can this issue be re-produced with the latest release?
Yes
4. What did you do?
table schema:
CREATETABLE `doctor` (
`id`bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`mobile`varchar(15) NOT NULL,
`name`varchar(50) NOT NULL ,
`status`tinyint(1) unsigned NOT NULL DEFAULT '1' ,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`deleted_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
// dao.Doctor is gf generate dao structm:=dao.Doctor.Ctx(gctx.New())
vardoctor entity.Doctor_=m.Where("mobile", "").
Where(m.Builder().Where("id", 1).WhereOrLike("name", "foo")).
Where("status", 2).
OmitEmpty().Scan(&doctor)
// expect sql: // SELECT `id` FROM `doctor` WHERE ((`id`=1) OR (`name` LIKE 'foo')) AND (`status`=2) AND `deleted_at` IS NULL LIMIT 1// But the generated SQL below is wrong:// The first statement is filtered out, second is a nested statement, but it's been expanded to the level of the third statement// SELECT `id` FROM `doctor` WHERE ((`id`=1) OR (`name` LIKE 'foo') AND (`status`=2)) AND `deleted_at` IS NULL LIMIT 1
The text was updated successfully, but these errors were encountered:
Agzer0
changed the title
[bug] ORM builder with OmitEmpty generate SQL error
[bug] ORM builder with OmitEmpty generate wrong SQL
Jul 19, 2023
Agzer0
added a commit
to Agzer0/gf
that referenced
this issue
Jul 20, 2023
1. What version of
Go
and system type/arch are you using?go1.20.3
2. What version of
GoFrame
are you using?v2.4.0
3. Can this issue be re-produced with the latest release?
Yes
4. What did you do?
table schema:
The text was updated successfully, but these errors were encountered: