Skip to content

Commit b911c7e

Browse files
committed
WIP: push recent modifs (sqlite)
1 parent f86ee3e commit b911c7e

15 files changed

Lines changed: 922 additions & 108 deletions

File tree

Readme.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ This is inspired by [SQLC](https://github.com/sqlc-dev/sqlc) but pushes the idea
1414
## Features
1515

1616
* **Convenient**: All the structs are generated for you, No need for manual DTO/PDO
17-
* **Time Saver**: All the basic queries (CRUD) are generated from your schema alone
17+
* **Time Saver**: All the basic queries (CRUD) are generated from your schema alone, less queries to write
1818
* **Developer Friendly**: The code generated contains comments, examples and is designed with IDE autocompletion in mind
1919
* **Flexible**: Provide a way to run dynamic queries (pagination, search, ...)
20-
* **Composable**: Use filters auto-generated or make your owns and reuse them across queries
20+
* **Composable**: Use auto-generated query filters or make your owns and reuse them across queries
2121
* **Safe**: All the SQL queries use prepared statement to avoid injection
2222
* **Consistent**: Easy to use transaction API to rollback when an error occurs
2323

@@ -108,15 +108,23 @@ This repository is currently a WIP, features are still not complete and may like
108108

109109
Also the current SQL Parser being based on CockroachDB, some postgres specific syntax may be not supported.
110110

111+
**Known Bug**:
112+
* Sqlite:
113+
* [ ] Generated code contains not supported keywords (like `ANY`, just need more tests)
114+
* [ ] Batch insert not working, syntax not supported in sqlite
115+
* Postgres
116+
* [x] When multiple where condition are combined, index may conflict
117+
* [ ] In sqlx+pq, some advanced type serialization are not supported (like jsonb)
118+
111119
**Roadmap**:
112120
* [x] Handle custom user queries
113121
* [ ] Handle sql enums
114122
* [ ] Handle sql views
115123
* [ ] Support more types and custom types (cf ulid, ...)
116124
* [ ] Support more driver and database Mysql/MariaDB/Sqlite3
117-
* [x] For postgres support both `pq + sqlc` or `pgx`
118-
* [ ] For Mysql/MariaDB `go-sql-driver`
119-
* [ ] For Sqlite ``
125+
* [x] For Postgres support both `pq + sqlc` or `pgx`
126+
* [ ] For Mysql/MariaDB `go-sql-driver` (throught sqlx)
127+
* [x] For Sqlite `modernc.org/sqlite` (throught sqlx)
120128
* [ ] Support easier logging and profiling
121129
* [ ] Support for Listen/Notify on pgx
122130
* [ ] Support DB Introspection to automatically extract schema from running database

go.mod

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ require (
1818
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
1919
gorm.io/driver/postgres v1.5.9
2020
gorm.io/gorm v1.25.11
21+
modernc.org/sqlite v1.29.6
2122
)
2223

2324
require (
@@ -26,16 +27,15 @@ require (
2627
github.com/cockroachdb/errors v1.11.3 // indirect
2728
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
2829
github.com/cockroachdb/redact v1.1.5 // indirect
29-
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect
3030
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
3131
github.com/davecgh/go-spew v1.1.1 // indirect
3232
github.com/dustin/go-humanize v1.0.1 // indirect
3333
github.com/getsentry/raven-go v0.2.0 // indirect
3434
github.com/getsentry/sentry-go v0.28.1 // indirect
3535
github.com/gogo/protobuf v1.3.2 // indirect
3636
github.com/golang/protobuf v1.5.4 // indirect
37-
github.com/google/go-cmp v0.6.0 // indirect
3837
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
38+
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
3939
github.com/jackc/pgpassfile v1.0.0 // indirect
4040
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
4141
github.com/jackc/puddle/v2 v2.2.1 // indirect
@@ -45,10 +45,13 @@ require (
4545
github.com/kr/text v0.2.0 // indirect
4646
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
4747
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
48+
github.com/mattn/go-isatty v0.0.20 // indirect
4849
github.com/mfridman/interpolate v0.0.2 // indirect
50+
github.com/ncruces/go-strftime v0.1.9 // indirect
4951
github.com/pkg/errors v0.9.1 // indirect
5052
github.com/pmezard/go-difflib v1.0.0 // indirect
5153
github.com/pressly/goose/v3 v3.21.1 // indirect
54+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
5255
github.com/rogpeppe/go-internal v1.12.0 // indirect
5356
github.com/russross/blackfriday/v2 v2.1.0 // indirect
5457
github.com/sethvargo/go-retry v0.3.0 // indirect
@@ -57,7 +60,6 @@ require (
5760
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
5861
go.uber.org/multierr v1.11.0 // indirect
5962
golang.org/x/crypto v0.26.0 // indirect
60-
golang.org/x/net v0.27.0 // indirect
6163
golang.org/x/sync v0.8.0 // indirect
6264
golang.org/x/sys v0.24.0 // indirect
6365
golang.org/x/text v0.17.0 // indirect
@@ -67,4 +69,10 @@ require (
6769
google.golang.org/grpc v1.65.0 // indirect
6870
google.golang.org/protobuf v1.34.2 // indirect
6971
gopkg.in/yaml.v3 v3.0.1 // indirect
72+
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
73+
modernc.org/libc v1.41.0 // indirect
74+
modernc.org/mathutil v1.6.0 // indirect
75+
modernc.org/memory v1.7.2 // indirect
76+
modernc.org/strutil v1.2.0 // indirect
77+
modernc.org/token v1.1.0 // indirect
7078
)

0 commit comments

Comments
 (0)