-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: More SQL Syntax Support for SQLite #1687
feat: More SQL Syntax Support for SQLite #1687
Conversation
* Add support `where` and `join` clause * Add support table alias
* column_as * comment_syntax * comparisons * create_view
* identical_tables * inflection * insert_select * insert_select_invalid * insert_values
* support `GROUP BY` and `HAVING` * support `ORDER BY` * support wildcard(`*`) column with table name
* invalid_group_by_reference * invalid_table_alias * join_alias * join_from * join_left * join_left_same_table * join_table_name * join_two_tables * join_where_clause
* limit * limit_offset
* select_limit * limit_offset * single_param_conflict * update_set * update_set_multiple
This looks awesome, let me test a little bit but I'm definitely inclined to close out #1686 in favor of this. |
Wow, yeah lets go with this. I just got the Update statement working on my local branch after some work this morning, but this covers all that and more. So nice work @hakobera! |
Ran this against my (still pretty minimal) codebase and results look great. Its generating identical code for SELECT compared to #1686, identical code for INSERT compared to #1653, plus is generating correct-looking code for UPDATEs which I didn't have a solution for yet. Closed my PR in favor of this. |
I executed some tests over a small project and it works!!!.
-- name: Insert :exec
INSERT INTO users (uuid, email, phone) VALUES (?, ?, ?); Generated Go code func (q *Queries) Insert(ctx context.Context, arg InsertParams) error {
_, err := q.db.ExecContext(ctx, insert, arg.Uuid, arg.Email, arg.Phone)
return err
} Better func (q *Queries) Insert(ctx context.Context, arg InsertParams) (int64, error) {
result, err := q.db.ExecContext(ctx, insert, arg.Uuid, arg.Email, arg.Phone)
if err != nil {
return 0, err
}
return result.LastInsertId()
} EDIT: The correct way to do this is -- name: Insert :execresult
INSERT INTO users (uuid, email, phone) VALUES (?, ?, ?); |
This pull request includes multiple SQL Syntax supports for SQLite for #161
Features
SELECT
WHERE
,GROUP BY
,HAVING
,LIMIT
,OFFSET
SELECT
likeselect_nested_count
INSERT
SELECT
insertUPDATE
CREATE VIEW
andDROP VIEW
bool
typecoalesce
functionExamples
Also add
endtoend
test data as much as possible.Breaking Change
numeric
anddecimal
are mapped tofloat64
(currently these are mapped toint64