Git Product home page Git Product logo

Comments (8)

aixj1984 avatar aixj1984 commented on June 19, 2024

select_test.go:302: errors happened when select expect: SELECT * FROM Users WHERE id IN (1,2), got SELECT * FROM Users WHERE id IN ('1','2')

TestSelectByIdName : errors happened when select expect: SELECT * FROM Users WHERE id = 1 LIMIT 1, got SELECT * FROM Users WHERE id = 1 ORDER BY Users.id LIMIT 1

from gorm-plus.

afumu avatar afumu commented on June 19, 2024

select_test.go:302: errors happened when select expect: SELECT * FROM Users WHERE id IN (1,2), got SELECT * FROM Users WHERE id IN ('1','2')

TestSelectByIdName : errors happened when select expect: SELECT * FROM Users WHERE id = 1 LIMIT 1, got SELECT * FROM Users WHERE id = 1 ORDER BY Users.id LIMIT 1

我这边测试没有问题呀

from gorm-plus.

aixj1984 avatar aixj1984 commented on June 19, 2024

你把user的结构体换成我上面的,再跑测试

from gorm-plus.

afumu avatar afumu commented on June 19, 2024

select_test.go:302: errors happened when select expect: SELECT * FROM Users WHERE id IN (1,2), got SELECT * FROM Users WHERE id IN ('1','2')
TestSelectByIdName : errors happened when select expect: SELECT * FROM Users WHERE id = 1 LIMIT 1, got SELECT * FROM Users WHERE id = 1 ORDER BY Users.id LIMIT 1

这个错误跟结构体没有关系,你那边应该没有更新到最新的测试代码吧

from gorm-plus.

aixj1984 avatar aixj1984 commented on June 19, 2024

--- FAIL: TestQueryByIdsIn (0.00s)
select_test.go:302: errors happened when select expect: SELECT * FROM Users WHERE id IN (1,2), got SELECT * FROM Users WHERE id IN ('1','2')

func TestQueryByIdsIn(t *testing.T) {
values := url.Values{}
values["q"] = []string{"id?=1,2"}
query := gplus.BuildQueryUser
var expectSql = "SELECT * FROM Users WHERE id IN (1,2)"
sessionDb := checkSelectSql(t, expectSql)
gplus.SelectList[User](query, gplus.Db(sessionDb))
}

是因为gplus.BuildQuery的时候,没有把ID识别成int64,所有导致出来的是字符串,而识别到的就是int64值,问题就出在这里

from gorm-plus.

afumu avatar afumu commented on June 19, 2024

--- FAIL: TestQueryByIdsIn (0.00s) select_test.go:302: errors happened when select expect: SELECT * FROM Users WHERE id IN (1,2), got SELECT * FROM Users WHERE id IN ('1','2')

func TestQueryByIdsIn(t *testing.T) { values := url.Values{} values["q"] = []string{"id?=1,2"} query := gplus.BuildQueryUser var expectSql = "SELECT * FROM Users WHERE id IN (1,2)" sessionDb := checkSelectSql(t, expectSql) gplus.SelectList[User](query, gplus.Db(sessionDb)) }

是因为gplus.BuildQuery的时候,没有把ID识别成int64,所有导致出来的是字符串,而识别到的就是int64值,问题就出在这里

哦哦,确实嵌套会有问题,主要在获取类型那块,得递归缓存好类型信息

from gorm-plus.

afumu avatar afumu commented on June 19, 2024

--- FAIL: TestQueryByIdsIn (0.00s) select_test.go:302: errors happened when select expect: SELECT * FROM Users WHERE id IN (1,2), got SELECT * FROM Users WHERE id IN ('1','2')
func TestQueryByIdsIn(t *testing.T) { values := url.Values{} values["q"] = []string{"id?=1,2"} query := gplus.BuildQueryUser var expectSql = "SELECT * FROM Users WHERE id IN (1,2)" sessionDb := checkSelectSql(t, expectSql) gplus.SelectList[User](query, gplus.Db(sessionDb)) }
是因为gplus.BuildQuery的时候,没有把ID识别成int64,所有导致出来的是字符串,而识别到的就是int64值,问题就出在这里

哦哦,确实嵌套会有问题,主要在获取类型那块,得递归缓存好类型信息

看这里 #63

from gorm-plus.

aixj1984 avatar aixj1984 commented on June 19, 2024

问题已经解决

from gorm-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.