parse_disabled.go 754 B

1234567891011121314151617181920212223242526272829303132333435
  1. //go:build windows || !cgo
  2. // +build windows !cgo
  3. package postgresql
  4. import (
  5. "errors"
  6. "io"
  7. "runtime"
  8. "github.com/sqlc-dev/sqlc/internal/source"
  9. "github.com/sqlc-dev/sqlc/internal/sql/ast"
  10. )
  11. func NewParser() *Parser {
  12. return &Parser{}
  13. }
  14. type Parser struct {
  15. }
  16. func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) {
  17. if runtime.GOOS == "windows" {
  18. return nil, errors.New("the PostgreSQL engine does not support Windows.")
  19. }
  20. return nil, errors.New("the PostgreSQL engine requires cgo. Please set CGO_ENABLED=1.")
  21. }
  22. // https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS
  23. func (p *Parser) CommentSyntax() source.CommentSyntax {
  24. return source.CommentSyntax{
  25. Dash: true,
  26. SlashStar: true,
  27. }
  28. }