MCPcopy
hub / github.com/sqldef/sqldef / Format

Method Format

parser/node.go:1310–1336  ·  view source on GitHub ↗

Format formats the node.

(buf *nodeBuffer)

Source from the content-addressed store, hash-verified

1308
1309// Format formats the node.
1310func (node *Show) Format(buf *nodeBuffer) {
1311 if node.Type == "tables" && node.ShowTablesOpt != nil {
1312 opt := node.ShowTablesOpt
1313 if opt.DbName != "" {
1314 if opt.Filter != nil {
1315 buf.Printf("show %s%stables from %s %v", opt.Extended, opt.Full, opt.DbName, opt.Filter)
1316 } else {
1317 buf.Printf("show %s%stables from %s", opt.Extended, opt.Full, opt.DbName)
1318 }
1319 } else {
1320 if opt.Filter != nil {
1321 buf.Printf("show %s%stables %v", opt.Extended, opt.Full, opt.Filter)
1322 } else {
1323 buf.Printf("show %s%stables", opt.Extended, opt.Full)
1324 }
1325 }
1326 return
1327 }
1328 if node.Scope == "" {
1329 buf.Printf("show %s", node.Type)
1330 } else {
1331 buf.Printf("show %s %s", node.Scope, node.Type)
1332 }
1333 if !node.OnTable.Name.IsEmpty() {
1334 buf.Printf(" on %v", node.OnTable)
1335 }
1336}
1337
1338// ShowTablesOpt is show tables option
1339type ShowTablesOpt struct {

Callers

nothing calls this directly

Calls 2

PrintfMethod · 0.65
IsEmptyMethod · 0.45

Tested by

no test coverage detected