query.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package compiler
  2. import (
  3. "github.com/sqlc-dev/sqlc/internal/metadata"
  4. "github.com/sqlc-dev/sqlc/internal/sql/ast"
  5. "github.com/sqlc-dev/sqlc/internal/sql/catalog"
  6. )
  7. type Function struct {
  8. Rel *ast.FuncName
  9. ReturnType *ast.TypeName
  10. Outs []*catalog.Argument
  11. }
  12. type Table struct {
  13. Rel *ast.TableName
  14. Columns []*Column
  15. }
  16. type Column struct {
  17. Name string
  18. OriginalName string
  19. DataType string
  20. NotNull bool
  21. Unsigned bool
  22. IsArray bool
  23. ArrayDims int
  24. Comment string
  25. Length *int
  26. IsNamedParam bool
  27. IsFuncCall bool
  28. // XXX: Figure out what PostgreSQL calls `foo.id`
  29. Scope string
  30. Table *ast.TableName
  31. TableAlias string
  32. Type *ast.TypeName
  33. EmbedTable *ast.TableName
  34. IsSqlcSlice bool // is this sqlc.slice()
  35. skipTableRequiredCheck bool
  36. }
  37. type Query struct {
  38. SQL string
  39. Metadata metadata.Metadata
  40. Columns []*Column
  41. Params []Parameter
  42. // Needed for CopyFrom
  43. InsertIntoTable *ast.TableName
  44. // Needed for vet
  45. RawStmt *ast.RawStmt
  46. }
  47. type Parameter struct {
  48. Number int
  49. Column *Column
  50. }