Skip to content

Commit 3851798

Browse files
author
paulknebel
committed
feat: added soft wrapper around some internal functions
1 parent 6389cdc commit 3851798

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

pkg/api/api.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package api
2+
3+
import (
4+
"bytes"
5+
"context"
6+
"fmt"
7+
"path/filepath"
8+
"regexp"
9+
"strconv"
10+
"strings"
11+
"time"
12+
13+
"github.com/sqlc-dev/sqlc/internal/cmd"
14+
)
15+
16+
type Options struct {
17+
Dir string // working directory for relative paths
18+
Filename string
19+
Options *cmd.Options
20+
}
21+
22+
type Diagnostic struct {
23+
File string
24+
Line int
25+
Column int
26+
Severity string // "error" | "warning" | "info"
27+
Message string
28+
Raw string
29+
}
30+
31+
type Report struct {
32+
Stdout string
33+
Stderr string
34+
Diagnostics []Diagnostic
35+
}
36+
37+
func Generate(ctx context.Context, opt Options) (map[string]string, error) {
38+
return cmd.Generate(ctx, opt.Dir, opt.Filename, opt.Options)
39+
}
40+
41+
func Verify(ctx context.Context, opt Options) error {
42+
return cmd.Verify(ctx, opt.Dir, opt.Filename, opt.Options)
43+
}

0 commit comments

Comments
 (0)