Encapsulate batch operations on multiple tables/entities#160
Conversation
|
By the way, it would be helpful if you could share some suggestions on naming terminologies and variables. |
|
This patch is huge I did not expect it. Few things:
Design objectives:
|
|
Thanks.
Would you please share some of the shortcommings? |
|
Batch is a special kind of query. I'd have to double check what happens when you send batch as a normal query. If you get to know anything keep me posted. |
|
The difficiences are below:
Shall we make a PR first for re-implementing gocqlx.Batch? |
|
qb package is just a query builder I think there is nothing to fix at this point. You can send PR add your findings to https://github.com/scylladb/gocqlx/blob/master/qb/batch.go#L27. The whole point of this PR is adding proper API for working with batches that implement manual "view" creation - that is one entity multiple pks. |
|
gocql.Batch cannot be "prepared" beforehand like what I do with gocqlx.qb.BatchBuilder because Query or Bind in gocq.Batch requires args immediately. |
|
That's an interesting point. I'd suggest you measure that first, maybe in your case it's better to prepare the batch? If we were to use batch I think gocqlx needs to be changed to allow getting values for names - like in BindStruct. |
|
Can we postpone deprecating qb.BatchBuilder? |
|
May I go on using qb.BatchBuilder to implement this MR? |
|
I am thinking whether I can keep using qb.Batchbuilder for this MR. |
|
Correct, let's use qb.BatchBuilder for now. |
|
Originally I just wanted to add the pre-constructed batch cqls. So I'd like to chagne the target of this MR from |
|
Maybe I'm missing something but it looks quite easy.
What could we simplify here for a general audience? |
|
@mmatczuk It seems that I didn't express myself clearly. As you will see, instead of the 5 steps what you mentioned, the developer can now call only one API: Please let me know if it makes sense or not. |
@mmatczuk
I made this PR as a draft version for the purpose of POC.
The code has't been carefully polished yet.
Please just have a quick look and let me know if this is what we want.
Then I will spend some time on polishing the PR.