MCPcopy
hub / github.com/ent/ent / As

Function As

dialect/sql/builder.go:1540–1546  ·  view source on GitHub ↗

As suffixed the given column with an alias (`a` AS `b`).

(ident string, as string)

Source from the content-addressed store, hash-verified

1538
1539// As suffixed the given column with an alias (`a` AS `b`).
1540func As(ident string, as string) string {
1541 b := &Builder{}
1542 b.fromIdent(ident)
1543 b.Ident(ident).Pad().WriteString("AS")
1544 b.Pad().Ident(as)
1545 return b.String()
1546}
1547
1548// Distinct prefixed the given columns with the `DISTINCT` keyword (DISTINCT `id`).
1549func Distinct(idents ...string) string {

Callers 15

SelectFunction · 0.92
RelationFunction · 0.92
AsFunction · 0.92
AsFunction · 0.92
AsFunction · 0.92
AsFunction · 0.92
AsFunction · 0.92
AsFunction · 0.92
AsFunction · 0.92
AsFunction · 0.92
TestMySQLFunction · 0.92
TestVersionedMigrationFunction · 0.92

Calls 5

fromIdentMethod · 0.95
PadMethod · 0.95
IdentMethod · 0.95
StringMethod · 0.95
WriteStringMethod · 0.80

Tested by 7

SelectFunction · 0.74
RelationFunction · 0.74
TestMySQLFunction · 0.74
TestVersionedMigrationFunction · 0.74
TestCustomTemplateFunction · 0.74
TestBuilderFunction · 0.56
TestMultipleFromFunction · 0.56