(t *testing.T)
| 280 | } |
| 281 | |
| 282 | func TestSelectJoinClausePlaceholderNumbering(t *testing.T) { |
| 283 | subquery := Select("a").Where(Eq{"b": 2}).PlaceholderFormat(Dollar) |
| 284 | |
| 285 | sql, args, err := Select("t1.a"). |
| 286 | From("t1"). |
| 287 | Where(Eq{"a": 1}). |
| 288 | JoinClause(subquery.Prefix("JOIN (").Suffix(") t2 ON (t1.a = t2.a)")). |
| 289 | PlaceholderFormat(Dollar). |
| 290 | ToSql() |
| 291 | assert.NoError(t, err) |
| 292 | |
| 293 | expectedSql := "SELECT t1.a FROM t1 JOIN ( SELECT a WHERE b = $1 ) t2 ON (t1.a = t2.a) WHERE a = $2" |
| 294 | assert.Equal(t, expectedSql, sql) |
| 295 | assert.Equal(t, []interface{}{2, 1}, args) |
| 296 | } |
| 297 | |
| 298 | func ExampleSelect() { |
| 299 | Select("id", "created", "first_name").From("users") // ... continue building up your query |
nothing calls this directly
no test coverage detected
searching dependent graphs…