MCPcopy
hub / github.com/gogf/gf / TestTableFields

Function TestTableFields

contrib/drivers/dm/dm_z_unit_basic_test.go:77–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

75}
76
77func TestTableFields(t *testing.T) {
78 tables := "A_tables"
79 createInitTable(tables)
80 gtest.C(t, func(t *gtest.T) {
81 var expect = map[string][]any{
82 "ID": {"BIGINT(8)", false},
83 "ACCOUNT_NAME": {"VARCHAR(128)", false},
84 "PWD_RESET": {"TINYINT(1)", false},
85 "ATTR_INDEX": {"INT(4)", true},
86 "DELETED": {"INT(4)", false},
87 "CREATED_TIME": {"TIMESTAMP(8)", false},
88 }
89
90 res, err := db.TableFields(ctx, tables)
91 gtest.AssertNil(err)
92
93 for k, v := range expect {
94 _, ok := res[k]
95 gtest.AssertEQ(ok, true)
96
97 gtest.AssertEQ(res[k].Name, k)
98 gtest.Assert(res[k].Type, v[0])
99 gtest.Assert(res[k].Null, v[1])
100 }
101
102 })
103
104 gtest.C(t, func(t *gtest.T) {
105 _, err := db.TableFields(ctx, "t_user t_user2")
106 gtest.AssertNE(err, nil)
107 })
108}
109
110func TestTableFields_WithWrongPassword(t *testing.T) {
111 gtest.C(t, func(t *gtest.T) {

Callers

nothing calls this directly

Calls 7

CFunction · 0.92
AssertNilFunction · 0.92
AssertEQFunction · 0.92
AssertFunction · 0.92
AssertNEFunction · 0.92
createInitTableFunction · 0.70
TableFieldsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…