-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow selecting columns with NULL values (#18)
* feat: Allow selecting columns with NULL values
- Loading branch information
Showing
3 changed files
with
32 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,76 +30,82 @@ type TestExpect struct { | |
const FirestoreEmulatorHost = "FIRESTORE_EMULATOR_HOST" | ||
|
||
var selectTests = []TestExpect{ | ||
TestExpect{ | ||
{ | ||
query: "select * from users", | ||
columns: []string{"id", "email", "username", "address", "name"}, | ||
length: "21", | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select * from `users`", | ||
columns: []string{"id", "email", "username", "address", "name"}, | ||
length: "21", | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select id as uid, * from users", | ||
columns: []string{"uid", "id", "email", "username", "address", "name"}, | ||
length: "21", | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select *, username as uname from users", | ||
columns: []string{"id", "email", "username", "address", "name", "uname"}, | ||
length: "21", | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select id as uid, *, username as uname from users", | ||
columns: []string{"uid", "id", "email", "username", "address", "name", "uname"}, | ||
length: "21", | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select id, email, address from users", | ||
columns: []string{"id", "email", "address"}, | ||
length: "21", | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select id, email, address from users limit 5", | ||
columns: []string{"id", "email", "address"}, | ||
length: "5", | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select id from users where email='[email protected]'", | ||
columns: []string{"id"}, | ||
length: "1", | ||
records: [][]interface{}{[]interface{}{float64(20)}}, | ||
records: [][]interface{}{{float64(20)}}, | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select id from users order by id desc limit 1", | ||
columns: []string{"id"}, | ||
length: "1", | ||
records: [][]interface{}{[]interface{}{float64(21)}}, | ||
records: [][]interface{}{{float64(21)}}, | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select LENGTH(username) as uLen from users where id = 8", | ||
columns: []string{"uLen"}, | ||
length: "1", | ||
records: [][]interface{}{[]interface{}{float64(6)}}, | ||
records: [][]interface{}{{float64(6)}}, | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select id from users where `address.city` = 'Glendale' and name = 'Eleanora'", | ||
columns: []string{"id"}, | ||
length: "1", | ||
records: [][]interface{}{[]interface{}{float64(10)}}, | ||
records: [][]interface{}{{float64(10)}}, | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select id > 0 as has_id from users where `address.city` = 'Glendale' and name = 'Eleanora'", | ||
columns: []string{"has_id"}, | ||
length: "1", | ||
records: [][]interface{}{[]interface{}{true}}, | ||
records: [][]interface{}{{true}}, | ||
}, | ||
TestExpect{ | ||
{ | ||
query: "select __name__ from users where id = 1", | ||
columns: []string{"__name__"}, | ||
length: "1", | ||
records: [][]interface{}{[]interface{}{"1"}}, | ||
records: [][]interface{}{{"1"}}, | ||
}, | ||
{ | ||
query: "select id, email, username from users where id = 21", | ||
columns: []string{"id", "email", "username"}, | ||
length: "1", | ||
records: [][]interface{}{{float64(21), nil, "ckensleyk"}}, | ||
}, | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,7 +183,7 @@ | |
"id": 21, | ||
"name": "Doyle", | ||
"username": "ckensleyk", | ||
"email": "[email protected]", | ||
"email": null, | ||
"address": { | ||
"city": "Fayetteville" | ||
} | ||
|