good morning!!!!

Skip to content
Snippets Groups Projects
Commit 80ee2945 authored by Carlos Nieto's avatar Carlos Nieto
Browse files

Adding explicit Select() to Find() statements, to include QL's id() function.

parent 29ef5df0
Branches
Tags
No related merge requests found
...@@ -265,7 +265,7 @@ func TestResultFetch(t *testing.T) { ...@@ -265,7 +265,7 @@ func TestResultFetch(t *testing.T) {
} }
// Testing map // Testing map
res = artist.Find() res = artist.Find().Select("id() AS id", "name")
row_m := map[string]interface{}{} row_m := map[string]interface{}{}
...@@ -297,7 +297,7 @@ func TestResultFetch(t *testing.T) { ...@@ -297,7 +297,7 @@ func TestResultFetch(t *testing.T) {
Name string Name string
}{} }{}
res = artist.Find() res = artist.Find().Select("id() AS id", "name")
for { for {
err = res.Next(&row_s) err = res.Next(&row_s)
...@@ -327,7 +327,7 @@ func TestResultFetch(t *testing.T) { ...@@ -327,7 +327,7 @@ func TestResultFetch(t *testing.T) {
Value2 string `field:"name"` Value2 string `field:"name"`
}{} }{}
res = artist.Find() res = artist.Find().Select("id() AS id", "name")
for { for {
err = res.Next(&row_t) err = res.Next(&row_t)
...@@ -352,7 +352,7 @@ func TestResultFetch(t *testing.T) { ...@@ -352,7 +352,7 @@ func TestResultFetch(t *testing.T) {
res.Close() res.Close()
// Testing Result.All() with a slice of maps. // Testing Result.All() with a slice of maps.
res = artist.Find() res = artist.Find().Select("id() AS id", "name")
all_rows_m := []map[string]interface{}{} all_rows_m := []map[string]interface{}{}
err = res.All(&all_rows_m) err = res.All(&all_rows_m)
...@@ -368,7 +368,7 @@ func TestResultFetch(t *testing.T) { ...@@ -368,7 +368,7 @@ func TestResultFetch(t *testing.T) {
} }
// Testing Result.All() with a slice of structs. // Testing Result.All() with a slice of structs.
res = artist.Find() res = artist.Find().Select("id() AS id", "name")
all_rows_s := []struct { all_rows_s := []struct {
Id uint64 Id uint64
...@@ -387,7 +387,7 @@ func TestResultFetch(t *testing.T) { ...@@ -387,7 +387,7 @@ func TestResultFetch(t *testing.T) {
} }
// Testing Result.All() with a slice of tagged structs. // Testing Result.All() with a slice of tagged structs.
res = artist.Find() res = artist.Find().Select("id() AS id", "name")
all_rows_t := []struct { all_rows_t := []struct {
Value1 uint64 `field:"id"` Value1 uint64 `field:"id"`
...@@ -434,7 +434,7 @@ func TestUpdate(t *testing.T) { ...@@ -434,7 +434,7 @@ func TestUpdate(t *testing.T) {
}{} }{}
// Getting the first artist. // Getting the first artist.
res := artist.Find(db.Cond{"id !=": 0}).Limit(1) res := artist.Find(db.Cond{"id() !=": 0}).Limit(1)
err = res.One(&value) err = res.One(&value)
...@@ -530,7 +530,7 @@ func TestRemove(t *testing.T) { ...@@ -530,7 +530,7 @@ func TestRemove(t *testing.T) {
} }
// Getting the artist with id = 1 // Getting the artist with id = 1
res := artist.Find(db.Cond{"id": 1}) res := artist.Find(db.Cond{"id()": 1})
// Trying to remove the row. // Trying to remove the row.
err = res.Remove() err = res.Remove()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment