MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestGetColumnTypeName

Function TestGetColumnTypeName

backend/plugin/db/spanner/spanner_test.go:47–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestGetColumnTypeName(t *testing.T) {
48 tests := []struct {
49 spannerType sppb.Type
50 want string
51 }{
52 {
53 spannerType: sppb.Type{
54 Code: sppb.TypeCode_JSON,
55 },
56 want: "JSON",
57 },
58 {
59 spannerType: sppb.Type{
60 Code: sppb.TypeCode_DATE,
61 },
62 want: "DATE",
63 },
64 {
65 spannerType: sppb.Type{
66 Code: sppb.TypeCode_TIMESTAMP,
67 },
68 want: "TIMESTAMP",
69 },
70 {
71 spannerType: sppb.Type{
72 Code: sppb.TypeCode_ARRAY,
73 ArrayElementType: &sppb.Type{
74 Code: sppb.TypeCode_BYTES,
75 },
76 },
77 want: "[]BYTES",
78 },
79 }
80 a := require.New(t)
81 for i := range tests {
82 got, err := getColumnTypeName(&tests[i].spannerType)
83 a.NoError(err)
84 a.Equal(tests[i].want, got)
85 }
86}
87
88// Helper function to create expected timestamp RowValue for tests
89func timestampRowValue(rfc3339 string, accuracy int32) *v1pb.RowValue {

Callers

nothing calls this directly

Calls 2

getColumnTypeNameFunction · 0.85
EqualMethod · 0.65

Tested by

no test coverage detected