Fix test
This commit is contained in:
parent
b5c26997df
commit
dca8a72b64
|
@ -703,6 +703,13 @@ func (engine *Engine) AllCols() *Session {
|
|||
return session.AllCols()
|
||||
}
|
||||
|
||||
// Load loads associated fields from database
|
||||
func (engine *Engine) Load(beanOrSlices interface{}, cols ...string) error {
|
||||
session := engine.NewSession()
|
||||
session.isAutoClose = true
|
||||
return session.Load(beanOrSlices, cols...)
|
||||
}
|
||||
|
||||
// MustCols specify some columns must use even if they are empty
|
||||
func (engine *Engine) MustCols(columns ...string) *Session {
|
||||
session := engine.NewSession()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package xorm
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
|
|
@ -11,16 +11,18 @@ import (
|
|||
)
|
||||
|
||||
func TestExtendsTag(t *testing.T) {
|
||||
assert.NoError(t, prepareEngine())
|
||||
assert.NoError(t, PrepareEngine())
|
||||
|
||||
table := testEngine.TableInfo(new(Userdetail))
|
||||
table, err := testEngine.TableInfo(new(Userdetail))
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, table)
|
||||
assert.EqualValues(t, 3, len(table.ColumnsSeq()))
|
||||
assert.EqualValues(t, "id", table.ColumnsSeq()[0])
|
||||
assert.EqualValues(t, "intro", table.ColumnsSeq()[1])
|
||||
assert.EqualValues(t, "profile", table.ColumnsSeq()[2])
|
||||
|
||||
table = testEngine.TableInfo(new(Userinfo))
|
||||
table, err = testEngine.TableInfo(new(Userinfo))
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, table)
|
||||
assert.EqualValues(t, 8, len(table.ColumnsSeq()))
|
||||
assert.EqualValues(t, "id", table.ColumnsSeq()[0])
|
||||
|
@ -32,7 +34,8 @@ func TestExtendsTag(t *testing.T) {
|
|||
assert.EqualValues(t, "avatar", table.ColumnsSeq()[6])
|
||||
assert.EqualValues(t, "is_man", table.ColumnsSeq()[7])
|
||||
|
||||
table = testEngine.TableInfo(new(UserAndDetail))
|
||||
table, err = testEngine.TableInfo(new(UserAndDetail))
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, table)
|
||||
assert.EqualValues(t, 11, len(table.ColumnsSeq()))
|
||||
assert.EqualValues(t, "id", table.ColumnsSeq()[0])
|
||||
|
|
|
@ -24,6 +24,7 @@ type Interface interface {
|
|||
Alias(alias string) *Session
|
||||
Asc(colNames ...string) *Session
|
||||
BufferSize(size int) *Session
|
||||
Cascade(trueOrFalse ...bool) *Session
|
||||
Cols(columns ...string) *Session
|
||||
Count(...interface{}) (int64, error)
|
||||
CreateIndexes(bean interface{}) error
|
||||
|
@ -48,6 +49,7 @@ type Interface interface {
|
|||
IsTableExist(beanOrTableName interface{}) (bool, error)
|
||||
Iterate(interface{}, IterFunc) error
|
||||
Limit(int, ...int) *Session
|
||||
Load(beanOrSlices interface{}, cols ...string) error
|
||||
MustCols(columns ...string) *Session
|
||||
NoAutoCondition(...bool) *Session
|
||||
NotIn(string, ...interface{}) *Session
|
||||
|
|
Loading…
Reference in New Issue