MCPcopy Create free account
hub / github.com/araddon/qlbridge / TestSqlDriverMessage

Function TestSqlDriverMessage

datasource/context_test.go:94–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestSqlDriverMessage(t *testing.T) {
95 msg := datasource.NewSqlDriverMessage(0, vals)
96 smm := msg.ToMsgMap(colidx)
97 assert.Equal(t, msg.Vals, smm.Values())
98 smm.SetKey("hello")
99 smm.SetKeyHashed("name")
100 smm.SetRow(vals)
101 assert.Equal(t, msg.Vals, smm.Values())
102
103 smm = datasource.NewSqlDriverMessageMapVals(0, vals, cols)
104 val, ok := smm.Get("user.id")
105 assert.True(t, ok)
106 assert.Equal(t, int64(1), val.Value())
107 _, ok = smm.Get("user.notthere")
108 assert.Equal(t, false, ok)
109
110 row := smm.Row()
111 assert.Equal(t, 3, len(row))
112}
113
114func contextReaderTests(ctx expr.ContextReader) func(t *testing.T) {
115 return func(t *testing.T) {

Callers

nothing calls this directly

Calls 11

ToMsgMapMethod · 0.95
NewSqlDriverMessageFunction · 0.92
SetKeyMethod · 0.80
SetKeyHashedMethod · 0.80
SetRowMethod · 0.80
EqualMethod · 0.65
ValuesMethod · 0.65
GetMethod · 0.65
ValueMethod · 0.65
RowMethod · 0.65

Tested by

no test coverage detected