MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / formatJoin

Method formatJoin

cmd/gosqlx/cmd/sql_formatter.go:597–616  ·  view source on GitHub ↗

formatJoin formats JOIN clauses

(join *ast.JoinClause)

Source from the content-addressed store, hash-verified

595
596// formatJoin formats JOIN clauses
597func (f *SQLFormatter) formatJoin(join *ast.JoinClause) error {
598 if join.Type != "" {
599 f.writeKeyword(join.Type)
600 f.builder.WriteString(" ")
601 }
602 f.writeKeyword("JOIN")
603 f.builder.WriteString(" ")
604 f.formatTableReference(&join.Right)
605
606 if join.Condition != nil {
607 f.builder.WriteString(" ")
608 f.writeKeyword("ON")
609 f.builder.WriteString(" ")
610 if err := f.formatExpression(join.Condition); err != nil {
611 return err
612 }
613 }
614
615 return nil
616}
617
618// formatExpression formats SQL expressions
619func (f *SQLFormatter) formatExpression(expr ast.Expression) error {

Callers 1

formatSelectMethod · 0.95

Calls 3

writeKeywordMethod · 0.95
formatTableReferenceMethod · 0.95
formatExpressionMethod · 0.95

Tested by

no test coverage detected