(t *testing.T)
| 2099 | } |
| 2100 | |
| 2101 | func TestWindowFunction_Select(t *testing.T) { |
| 2102 | posts := Table("posts") |
| 2103 | q := Select(). |
| 2104 | AppendSelect("*"). |
| 2105 | AppendSelectExprAs( |
| 2106 | Window(func(b *Builder) { |
| 2107 | b.WriteString(Sum(posts.C("duration"))) |
| 2108 | }).PartitionBy("author_id").OrderBy("id"), "duration"). |
| 2109 | From(posts) |
| 2110 | |
| 2111 | query, args := q.Query() |
| 2112 | require.Equal(t, "SELECT *, (SUM(`posts`.`duration`) OVER (PARTITION BY `author_id` ORDER BY `id`)) AS `duration` FROM `posts`", query) |
| 2113 | require.Nil(t, args) |
| 2114 | } |
| 2115 | |
| 2116 | func TestSelector_UnqualifiedColumns(t *testing.T) { |
| 2117 | t1, t2 := Table("t1"), Table("t2") |
nothing calls this directly
no test coverage detected
searching dependent graphs…