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

Method Format

parser/node.go:698–724  ·  view source on GitHub ↗

Format formats the node

(buf *nodeBuffer)

Source from the content-addressed store, hash-verified

696
697// Format formats the node
698func (p *TablePartition) Format(buf *nodeBuffer) {
699 buf.Printf("partition by %s", strings.ToLower(p.Type))
700 if p.Columns != nil {
701 // RANGE COLUMNS, LIST COLUMNS, KEY
702 var cols []string
703 for _, c := range p.Columns {
704 cols = append(cols, String(&c))
705 }
706 buf.Printf(" (%s)", strings.Join(cols, ", "))
707 } else if p.Expr != nil {
708 // RANGE, LIST, HASH
709 buf.Printf(" (%v)", p.Expr)
710 }
711 if p.Partitions > 0 {
712 buf.Printf(" partitions %d", p.Partitions)
713 }
714 if len(p.Definitions) > 0 {
715 buf.Printf("\n(")
716 for i, def := range p.Definitions {
717 if i > 0 {
718 buf.Printf(",\n ")
719 }
720 def.Format(buf)
721 }
722 buf.Printf(")")
723 }
724}
725
726// TableSpec describes the structure of a table from a CREATE TABLE statement
727type TableSpec struct {

Callers

nothing calls this directly

Calls 3

StringFunction · 0.85
PrintfMethod · 0.65
FormatMethod · 0.65

Tested by

no test coverage detected