MCPcopy Index your code
hub / github.com/ent/ent / TestFormattedColumnFromSubQuery

Function TestFormattedColumnFromSubQuery

dialect/sql/builder_test.go:2203–2212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2201}
2202
2203func TestFormattedColumnFromSubQuery(t *testing.T) {
2204 q := Select("*").From(Select("*").AppendSelectExprAs(P(func(b *Builder) {
2205 b.SetDialect(dialect.Postgres)
2206 b.WriteString("calculate_score")
2207 b.Wrap(func(bb *Builder) {
2208 bb.WriteString(Table("table_name").C("field_name")).Comma().Args("test")
2209 })
2210 }), "score").From(Table("table_name").As("table_name_alias")))
2211 require.Equal(t, "`table_name_alias`.`score`", q.C("score"))
2212}
2213
2214func TestSelector_HasJoins(t *testing.T) {
2215 s := Select("*").From(Table("t1"))

Callers

nothing calls this directly

Calls 12

AppendSelectExprAsMethod · 0.80
WriteStringMethod · 0.80
WrapMethod · 0.80
ArgsMethod · 0.80
CommaMethod · 0.80
SelectFunction · 0.70
PFunction · 0.70
TableFunction · 0.70
SetDialectMethod · 0.65
CMethod · 0.65
FromMethod · 0.45
AsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…