/
githubmirror
/
sqlc
Обзор
Документация
Войти
/
githubmirror
/
sqlc
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
internal/sql/ast/create_function_stmt.go
45 строк
903 B
Kyle Gray
refactor(ast): rename Formatter interface to Dialect (#4208)
01 дек 2025, 04:49
Не верифицирован
01 дек 2025, 04:49
ebd32cf
Код
Авторство
О чём код?
package ast import "github.com/sqlc-dev/sqlc/internal/sql/format" type CreateFunctionStmt struct { Replace bool Params *List ReturnType *TypeName Func *FuncName // TODO: Understand these two fields Options *List WithClause *List } func (n *CreateFunctionStmt) Pos() int { return 0 } func (n *CreateFunctionStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } buf.WriteString("CREATE ") if n.Replace { buf.WriteString("OR REPLACE ") } buf.WriteString("FUNCTION ") buf.astFormat(n.Func, d) buf.WriteString("(") if items(n.Params) { buf.join(n.Params, d, ", ") } buf.WriteString(")") if n.ReturnType != nil { buf.WriteString(" RETURNS ") buf.astFormat(n.ReturnType, d) } // Format options (AS, LANGUAGE, etc.) if items(n.Options) { for _, opt := range n.Options.Items { buf.WriteString(" ") buf.astFormat(opt, d) } } }