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

Method WriteDialect

rel/sql.go:646–677  ·  view source on GitHub ↗
(w expr.DialectWriter)

Source from the content-addressed store, hash-verified

644 return w.String()
645}
646func (m *Column) WriteDialect(w expr.DialectWriter) {
647 if m.Star {
648 io.WriteString(w, "*")
649 return
650 }
651 exprStr := ""
652 if m.Expr != nil {
653 start := w.Len()
654 m.Expr.WriteDialect(w)
655 if w.Len() > start {
656 exprStr = w.String()[start:]
657 }
658 }
659
660 if m.asQuoteByte != 0 && m.originalAs != "" {
661 io.WriteString(w, " AS ")
662 w.WriteIdentity(m.As)
663 } else if m.originalAs != "" && exprStr != m.originalAs {
664 io.WriteString(w, " AS ")
665 w.WriteIdentity(m.originalAs)
666 } else if m.Expr == nil {
667 w.WriteIdentity(m.As)
668 }
669 if m.Guard != nil {
670 io.WriteString(w, " IF ")
671 m.Guard.WriteDialect(w)
672 }
673 if m.Order != "" {
674 io.WriteString(w, " ")
675 io.WriteString(w, m.Order)
676 }
677}
678
679// Is this a select count(*) column
680func (m *Column) CountStar() bool {

Callers 1

StringMethod · 0.95

Calls 4

LenMethod · 0.65
WriteDialectMethod · 0.65
StringMethod · 0.65
WriteIdentityMethod · 0.65

Tested by

no test coverage detected