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

Method Format

parser/node.go:605–625  ·  view source on GitHub ↗

Format formats the node.

(buf *nodeBuffer)

Source from the content-addressed store, hash-verified

603
604// Format formats the node.
605func (node *DDL) Format(buf *nodeBuffer) {
606 switch node.Action {
607 case CreateTable:
608 if node.PartitionOf != nil {
609 buf.Printf("create table %v partition of %v", node.NewName, node.PartitionOf.ParentTable)
610 node.PartitionOf.BoundSpec.Format(buf)
611 } else if node.TableSpec == nil {
612 buf.Printf("create table %v", node.NewName)
613 } else {
614 buf.Printf("create table %v %v", node.NewName, node.TableSpec)
615 }
616 case CreateView:
617 if node.View.SecurityType != "" {
618 buf.Printf("alter %v view %v as %v", node.View.SecurityType, node.View.Name, node.View.Definition)
619 } else {
620 buf.Printf("alter %v as %v", node.View.Name, node.View.Definition)
621 }
622 default:
623 panic(fmt.Sprintf("unexpected action: %v", node.Action))
624 }
625}
626
627// Format formats the PartitionBoundSpec node.
628func (node *PartitionBoundSpec) Format(buf *nodeBuffer) {

Callers

nothing calls this directly

Calls 2

PrintfMethod · 0.65
FormatMethod · 0.65

Tested by

no test coverage detected