Skip to content

Commit c9a6145

Browse files
authored
Initial Windows support (#886)
The PostgreSQL parser we use does not support Windows. However, the MySQL parser does. Update the engine/postgresql package to build on Windows. This version of the PostgreSQL parser always returns an error.
1 parent 1d778a1 commit c9a6145

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

.github/workflows/equinox.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ jobs:
1818
- uses: equinox-io/setup@master
1919
- run: go test -bench . -json -benchmem -run=XXX ./...
2020

21+
windows:
22+
name: release --platforms windows
23+
runs-on: windows-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Set up Go 1.14
27+
uses: actions/setup-go@v2
28+
with:
29+
go-version: '1.14'
30+
- uses: equinox-io/[email protected]
31+
- name: equinox release
32+
env:
33+
EQUINOX_API_TOKEN: ${{ secrets.EQUINOX_API_TOKEN }}
34+
EQUINOX_SIGNING_KEY: ${{ secrets.EQUINOX_SIGNING_KEY }}
35+
run: go run scripts/release.go -draft windows_amd64
36+
2137
macos:
2238
name: release --platforms darwin
2339
runs-on: macos-latest
@@ -37,7 +53,7 @@ jobs:
3753
linux:
3854
name: release --platforms linux
3955
runs-on: ubuntu-latest
40-
needs: [macos, benchmark]
56+
needs: [macos, windows, benchmark]
4157
steps:
4258
- uses: actions/checkout@v2
4359
- name: Set up Go 1.14

internal/engine/postgresql/convert.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build !windows
2+
13
package postgresql
24

35
import (

internal/engine/postgresql/parse.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build !windows
2+
13
package postgresql
24

35
import (
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// +build windows
2+
3+
package postgresql
4+
5+
import (
6+
"errors"
7+
"io"
8+
9+
"github.com/kyleconroy/sqlc/internal/metadata"
10+
"github.com/kyleconroy/sqlc/internal/sql/ast"
11+
)
12+
13+
func NewParser() *Parser {
14+
return &Parser{}
15+
}
16+
17+
type Parser struct {
18+
}
19+
20+
func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) {
21+
return nil, errors.New("the PostgreSQL engine does not support Windows")
22+
}
23+
24+
// https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS
25+
func (p *Parser) CommentSyntax() metadata.CommentSyntax {
26+
return metadata.CommentSyntax{
27+
Dash: true,
28+
SlashStar: true,
29+
}
30+
}

internal/engine/postgresql/utils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build !windows
2+
13
package postgresql
24

35
import (

0 commit comments

Comments
 (0)