query.go 927 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package compiler
  2. import (
  3. "github.com/kyleconroy/sqlc/internal/sql/ast"
  4. )
  5. type Function struct {
  6. Rel *ast.FuncName
  7. ReturnType *ast.TypeName
  8. }
  9. type Table struct {
  10. Rel *ast.TableName
  11. Columns []*Column
  12. }
  13. type Column struct {
  14. Name string
  15. DataType string
  16. NotNull bool
  17. IsArray bool
  18. Comment string
  19. Length *int
  20. IsNamedParam bool
  21. IsFuncCall bool
  22. // XXX: Figure out what PostgreSQL calls `foo.id`
  23. Scope string
  24. Table *ast.TableName
  25. TableAlias string
  26. Type *ast.TypeName
  27. skipTableRequiredCheck bool
  28. }
  29. type Query struct {
  30. SQL string
  31. Name string
  32. Cmd string // TODO: Pick a better name. One of: one, many, exec, execrows, copyFrom
  33. Columns []*Column
  34. Params []Parameter
  35. Comments []string
  36. // XXX: Hack
  37. Filename string
  38. // Needed for CopyFrom
  39. InsertIntoTable *ast.TableName
  40. }
  41. type Parameter struct {
  42. Number int
  43. Column *Column
  44. }