1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Upgrade xorm to v1.0.1 and fix start fail with potgres (#10819)

* upgrade xorm to v1.0.1

* fix start fail with postgres

Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
Lunny Xiao
2020-03-25 22:32:23 +08:00
committed by GitHub
parent b10cb7b258
commit 73f5ca70de
25 changed files with 226 additions and 149 deletions

12
vendor/xorm.io/xorm/session_find.go generated vendored
View File

@@ -11,6 +11,7 @@ import (
"xorm.io/builder"
"xorm.io/xorm/caches"
"xorm.io/xorm/internal/statements"
"xorm.io/xorm/internal/utils"
"xorm.io/xorm/schemas"
)
@@ -60,7 +61,8 @@ func (session *Session) FindAndCount(rowsSlicePtr interface{}, condiBean ...inte
session.statement.OrderStr = ""
}
return session.Count(reflect.New(sliceElementType).Interface())
// session has stored the conditions so we use `unscoped` to avoid duplicated condition.
return session.Unscoped().Count(reflect.New(sliceElementType).Interface())
}
func (session *Session) find(rowsSlicePtr interface{}, condiBean ...interface{}) error {
@@ -387,6 +389,12 @@ func (session *Session) cacheFind(t reflect.Type, sqlStr string, rowsSlicePtr in
slices := reflect.New(reflect.SliceOf(t))
beans := slices.Interface()
statement := session.statement
session.statement = statements.NewStatement(
session.engine.dialect,
session.engine.tagParser,
session.engine.DatabaseTZ,
)
if len(table.PrimaryKeys) == 1 {
ff := make([]interface{}, 0, len(ides))
for _, ie := range ides {
@@ -409,6 +417,8 @@ func (session *Session) cacheFind(t reflect.Type, sqlStr string, rowsSlicePtr in
return err
}
session.statement = statement
vs := reflect.Indirect(reflect.ValueOf(beans))
for i := 0; i < vs.Len(); i++ {
rv := vs.Index(i)