MCPcopy Create free account
hub / github.com/araddon/qlbridge / CountStar

Method CountStar

rel/sql.go:1278–1295  ·  view source on GitHub ↗

Is this a select count(*) FROM ... query?

()

Source from the content-addressed store, hash-verified

1276
1277// Is this a select count(*) FROM ... query?
1278func (m *SqlSelect) CountStar() bool {
1279 if len(m.Columns) != 1 {
1280 return false
1281 }
1282 col := m.Columns[0]
1283 if col.Expr == nil {
1284 return false
1285 }
1286 if f, ok := col.Expr.(*expr.FuncNode); ok {
1287 if strings.ToLower(f.Name) != "count" {
1288 return false
1289 }
1290 if len(f.Args) == 1 && f.Args[0].String() == "*" {
1291 return true
1292 }
1293 }
1294 return false
1295}
1296
1297// Rewrite take current SqlSelect statement and re-write it
1298func (m *SqlSelect) Rewrite() {

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected