MCPcopy Create free account
hub / github.com/datastax/cql-proxy / TestPartialBatchCodec_Encode

Function TestPartialBatchCodec_Encode

codecs/partial_codecs_test.go:421–542  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

419}
420
421func TestPartialBatchCodec_Encode(t *testing.T) {
422 tests := []struct {
423 name string
424 msg *message.Batch
425 }{
426 {
427 name: "simple",
428 msg: &message.Batch{
429 Type: primitive.BatchTypeLogged,
430 Children: []*message.BatchChild{
431 {Query: "select * from table1"},
432 {Id: []byte{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8}},
433 },
434 },
435 },
436 {
437 name: "positional values",
438 msg: &message.Batch{
439 Type: primitive.BatchTypeLogged,
440 Children: []*message.BatchChild{
441 {
442 Query: "select * from table1",
443 Values: []*primitive.Value{
444 {
445 Type: primitive.ValueTypeRegular,
446 Contents: []byte{0x1, 0x2, 0x3},
447 },
448 {
449 Type: primitive.ValueTypeRegular,
450 Contents: []byte{0x4, 0x5, 0x6},
451 },
452 },
453 },
454 {
455 Id: []byte{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8},
456 Values: []*primitive.Value{
457 {
458 Type: primitive.ValueTypeRegular,
459 Contents: []byte{0x1, 0x2, 0x3},
460 },
461 {
462 Type: primitive.ValueTypeRegular,
463 Contents: []byte{0x4, 0x5, 0x6},
464 },
465 },
466 },
467 },
468 },
469 },
470 {
471 name: "consistency",
472 msg: &message.Batch{
473 Type: primitive.BatchTypeLogged,
474 Children: []*message.BatchChild{
475 {Query: "select * from table1"},
476 {Id: []byte{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8}},
477 },
478 Consistency: primitive.ConsistencyLevelEachQuorum,

Callers

nothing calls this directly

Calls 9

DecodeMethod · 0.95
EncodedLengthMethod · 0.95
EncodeMethod · 0.95
consistencyLevelPtrFunction · 0.85
int64PtrFunction · 0.85
int32PtrFunction · 0.85
NewFrameBodyReaderFunction · 0.85
EncodedLengthMethod · 0.45
EncodeMethod · 0.45

Tested by

no test coverage detected