From 1083dcf0248fe62a4146affda1c5d9160d603361 Mon Sep 17 00:00:00 2001 From: "xiang.wang" Date: Tue, 2 Jun 2020 11:31:46 +0800 Subject: [PATCH] qb.BatchBuilder: Remove deprecated flag and add comments on its limitation and warning --- qb/batch.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qb/batch.go b/qb/batch.go index 4e14fec..4fa8bd5 100644 --- a/qb/batch.go +++ b/qb/batch.go @@ -23,6 +23,13 @@ type BatchBuilder struct { } // Batch returns a new BatchBuilder. +// BatchBuilder encapsulates batch cqls as one ordinary gocql.Query for convenience. +// Below are the limitations of encapsulating batch cqls based on gocql.Query instead of gocql.Batch: +// * gocql.Batch has some more batch specific check, such as BatchSize(65535). +// * gocql.Batch use BatchObserver instead of QueryObserver. +// * gocql.Batch has cancelBatch call back. +// * gocql.Batch prepares the included statements separately, which is more efficient. +// In contrast, gocqlx.qb.BatchBuilder, which is based on gocql.Query, prepares the whole batch statements as one ordinary query. // // Deprecated: Please use gocql.Session.NewBatch() instead. func Batch() *BatchBuilder {