Files
gf/contrib/drivers/dm/dm_z_unit_pr_test.go
tiger1103 ea956189bf feat(contrib/drivers/dm): add WherePri support (#4157)
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>
2025-12-03 17:52:05 +08:00

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")
})
}