MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / Format

Method Format

internal/sql/ast/create_function_stmt.go:19–45  ·  view source on GitHub ↗
(buf *TrackedBuffer, d format.Dialect)

Source from the content-addressed store, hash-verified

17}
18
19func (n *CreateFunctionStmt) Format(buf *TrackedBuffer, d format.Dialect) {
20 if n == nil {
21 return
22 }
23 buf.WriteString("CREATE ")
24 if n.Replace {
25 buf.WriteString("OR REPLACE ")
26 }
27 buf.WriteString("FUNCTION ")
28 buf.astFormat(n.Func, d)
29 buf.WriteString("(")
30 if items(n.Params) {
31 buf.join(n.Params, d, ", ")
32 }
33 buf.WriteString(")")
34 if n.ReturnType != nil {
35 buf.WriteString(" RETURNS ")
36 buf.astFormat(n.ReturnType, d)
37 }
38 // Format options (AS, LANGUAGE, etc.)
39 if items(n.Options) {
40 for _, opt := range n.Options.Items {
41 buf.WriteString(" ")
42 buf.astFormat(opt, d)
43 }
44 }
45}

Callers

nothing calls this directly

Calls 3

itemsFunction · 0.85
astFormatMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected