Documentation ¶
Overview ¶
Package genpg provides code generation helpers postgresql query and schema generation.
Index ¶
- Constants
- Variables
- func TypString(t typ.Type) (string, error)
- func WriteFile(fname string, p *dom.Project, s *dom.Schema) error
- func WriteLit(b *Writer, l lit.Lit) error
- func WriteQuote(w bfr.B, text string)
- type ExpEnv
- type Param
- type Translator
- type Writer
- func (w *Writer) Translate(env exp.Env, s *exp.Sym) (string, lit.Lit, error)
- func (w *Writer) WriteEl(env exp.Env, e exp.El) error
- func (w *Writer) WriteEnum(m *dom.Model) error
- func (w *Writer) WriteExpr(env exp.Env, e *exp.Call) error
- func (w *Writer) WriteSchema(s *dom.Schema) (err error)
- func (w *Writer) WriteTable(m *dom.Model) error
Constants ¶
View Source
const ( PrecOr PrecAnd PrecNot PrecIs // , is null, is not null, … PrecCmp // <, >, =, <=, >=, <>, != PrecIn // , between, like, ilike, similar PrecDef PrecAdd // +, - PrecMul // *, /, % )
Variables ¶
View Source
var External = cor.StrError("external symbol")
Functions ¶
func WriteQuote ¶
WriteQuote quotes a string as a postgres string, all single quotes are use sql escaping.
Types ¶
type Translator ¶
type Writer ¶
type Writer struct { gen.Gen Translator Params []Param }
func (*Writer) WriteEl ¶
WriteEl writes the element e to b or returns an error. This is used for explicit selectors for example.
func (*Writer) WriteExpr ¶
WriteExpr writes the expression e to b using env or returns an error. Most xelf expressions with resolvers from the core or lib built-ins have a corresponding expression in postgresql. Custom resolvers can be rendered to sql by detecting and handling them before calling this function.
Click to show internal directories.
Click to hide internal directories.