mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
The Dameng database supports the wherepri method. eg: `dao.User.Ctx(ctx).WherePri(id)` --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: John Guo <claymore1986@gmail.com> Co-authored-by: hailaz <739476267@qq.com>
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
// Copyright 2019 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
|
//
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
// If a copy of the MIT was not distributed with this file,
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
package dm_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/gogf/gf/v2/test/gtest"
|
|
)
|
|
|
|
// PR #4157 WherePri
|
|
func Test_WherePri_PR4157(t *testing.T) {
|
|
tableName := "A_tables"
|
|
createInitTable(tableName)
|
|
defer dropTable(tableName)
|
|
gtest.C(t, func(t *gtest.T) {
|
|
var resOne *User
|
|
err := db.Model(tableName).WherePri(1).Scan(&resOne)
|
|
t.AssertNil(err)
|
|
t.AssertNQ(resOne, nil)
|
|
t.AssertEQ(resOne.ID, int64(1))
|
|
})
|
|
}
|
|
|
|
// PR #4157 get table field comments
|
|
func Test_TableFields_Comment_PR4157(t *testing.T) {
|
|
tableName := "A_tables"
|
|
schema := "SYSDBA"
|
|
createInitTable(tableName)
|
|
defer dropTable(tableName)
|
|
gtest.C(t, func(t *gtest.T) {
|
|
fields, err := db.Model().TableFields(tableName, schema)
|
|
t.AssertNil(err)
|
|
t.AssertEQ(fields["ACCOUNT_NAME"].Comment, "Account Name")
|
|
})
|
|
}
|