Skip to content

Commit d425c8d

Browse files
feat: implement Converter for SQL to MongoDB conversion with public API
1 parent be1fb8d commit d425c8d

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

pkg/zerosql/converter.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package zerosql
2+
3+
import (
4+
"github.com/synehq/zero-sql/internal/converter"
5+
)
6+
7+
// Converter wraps the internal converter to provide a public API
8+
type Converter struct {
9+
conv *converter.Converter
10+
}
11+
12+
// Options holds configuration for the converter
13+
type Options struct {
14+
Verbose bool
15+
}
16+
17+
// New creates a new Converter instance
18+
func New(opts *Options) *Converter {
19+
if opts == nil {
20+
opts = &Options{}
21+
}
22+
23+
conv := converter.New(&converter.Options{
24+
Verbose: opts.Verbose,
25+
})
26+
27+
return &Converter{
28+
conv: conv,
29+
}
30+
}
31+
32+
// ConvertSQLToMongo converts a SQL query to MongoDB aggregation pipeline
33+
func (c *Converter) ConvertSQLToMongo(sqlQuery string) ([]map[string]interface{}, error) {
34+
return c.conv.ConvertSQLToMongo(sqlQuery)
35+
}

0 commit comments

Comments
 (0)