(t *testing.T)
| 1661 | } |
| 1662 | |
| 1663 | func TestSelector_SetOperatorWithRecursive(t *testing.T) { |
| 1664 | t1, t2, t3 := Table("files"), Table("files"), Table("path") |
| 1665 | n := Queries{ |
| 1666 | WithRecursive("path", "id", "name", "parent_id"). |
| 1667 | As(Select(t1.Columns("id", "name", "parent_id")...). |
| 1668 | From(t1). |
| 1669 | Where( |
| 1670 | And( |
| 1671 | IsNull(t1.C("parent_id")), |
| 1672 | EQ(t1.C("deleted"), false), |
| 1673 | ), |
| 1674 | ). |
| 1675 | UnionAll( |
| 1676 | Select(t2.Columns("id", "name", "parent_id")...). |
| 1677 | From(t2). |
| 1678 | Join(t3). |
| 1679 | On(t2.C("parent_id"), t3.C("id")). |
| 1680 | Where( |
| 1681 | EQ(t2.C("deleted"), false), |
| 1682 | ), |
| 1683 | ), |
| 1684 | ), |
| 1685 | Select(t3.Columns("id", "name", "parent_id")...). |
| 1686 | From(t3), |
| 1687 | } |
| 1688 | query, args := n.Query() |
| 1689 | require.Equal(t, "WITH RECURSIVE `path`(`id`, `name`, `parent_id`) AS (SELECT `files`.`id`, `files`.`name`, `files`.`parent_id` FROM `files` WHERE `files`.`parent_id` IS NULL AND NOT `files`.`deleted` UNION ALL SELECT `files`.`id`, `files`.`name`, `files`.`parent_id` FROM `files` JOIN `path` AS `t1` ON `files`.`parent_id` = `t1`.`id` WHERE NOT `files`.`deleted`) SELECT `t1`.`id`, `t1`.`name`, `t1`.`parent_id` FROM `path` AS `t1`", query) |
| 1690 | require.Nil(t, args) |
| 1691 | } |
| 1692 | |
| 1693 | func TestBuilderContext(t *testing.T) { |
| 1694 | type key string |
nothing calls this directly
no test coverage detected
searching dependent graphs…