66 Commits

Author SHA1 Message Date
be8c537b9f Delete tests 2025-11-20 21:56:49 +01:00
Dmitry Kropachev
38001d64ac Update gocql version to v1.16.1 (#353)
* Update gocql version to v1.16.1

1. Update gocql to v1.16.1
2. Update golang to 1.25, since new gocql version requres it

* Update golangci to 2.5.0

It is needed since 1.64.8 does not support golang 1.25.
1. Update golangci to 2.5.0
2. Migrate from golangci config v1 to v2
3. Integrate fieldaligment to golangci
4. Drop fieldaligment from Makefile
5. Address complaints
2025-10-28 14:52:22 -04:00
Dmitry Kropachev
b0b3ded8da add ContextBatch api to create batch with context (#326) 2025-06-11 06:36:46 -04:00
Dmitry Kropachev
439a1ba517 Refactor Makefile tools installation (#313)
* Refactor Makefile tools installation

Updating tools is not easy due to the bad Makefile design
Make it easier to update tools, preparing to golang and gocql update.

* Apply make fix

* Cleanup github workflow
2025-04-25 08:34:30 -04:00
Dmitry Kropachev
2f79f86b7c Fix USING TIMEOUT time generation (#299)
Scylla does not support fractions.
We need to make sure that time is formatted the following way: XmYsZms
2025-01-27 11:22:34 -04:00
Sylwia Szunejko
6ba176a175 Add option to add ALLOW FILTERING to the update query (#290) 2024-09-10 10:13:54 -04:00
sylwiaszunejko
e7267922c4 Release v3 - change v2 suffix to v3
Because of recent changes there is a need for a new major
release. Changes are switching to scylladb/gocql and replacing
Unsafe with Strict mechanism.
2024-07-15 10:41:57 +02:00
Dmitry Kropachev
ab80d70106 Update golangci-lint and turn it on in CI 2024-06-19 08:08:54 +02:00
yemin.li
c965fdf183 fix using timeout order in select stmt 2022-03-24 09:22:03 +01:00
Drahflow
8054b9d47b Change tuple-element parameter names to name[idx] 2022-02-17 09:57:52 +01:00
Drahflow
58908485da Tests for tuple comparisons 2022-02-17 09:57:52 +01:00
Drahflow
72221591cc Add <Cmp>TupleNamed for range-queries on tuples 2022-02-17 09:57:52 +01:00
Gabriel Nelle
b56c610884 qb: avoid data race if rendering query builder in different go routines 2022-02-17 09:56:39 +01:00
Drahflow
cee96feae9 Make qb.DESC of type qb.Order, not bool 2022-02-11 10:33:00 +01:00
Nikita Karmatskikh
beeab600f9 qb: add named limit and per partition limit clauses 2021-11-23 11:42:34 +01:00
Michał Matczuk
979397bc5e qb: add support for USING TIMEOUT clause
In scylladb/scylla#7781 we added possibility to add timeout as part of USING spec.
This patch adds support for it by adding `Timeout` and `TimeoutNamed` functions to builders.

Fixes #194
2021-08-03 15:05:23 +02:00
Michał Matczuk
96a8de1e1e qb: using, modernize writeCql
- Add writePreamble function to handle USING vs AND usages
- Use Fprintf to avoid string allocation
2021-08-03 15:05:23 +02:00
Maciej Zimnoch
4ea6f42a51 Added Context variants of Query functions 2020-06-19 11:13:21 +02:00
Maciej Zimnoch
4f4f94e2e6 qb: Added shortcuts to Queryx
It allows to write shorter and more straightforward code.
Instead writing:

```
session.Query(qb.Select("cluster").Columns("id").ToCql())
```

you can write:

```
qb.Select("cluster").Columns("id").Query(session)
```
2020-06-17 16:44:48 +02:00
xiang.wang
1083dcf024 qb.BatchBuilder: Remove deprecated flag and add comments on its limitation and warning 2020-06-05 15:46:37 +02:00
xiang.wang
d76ea6c678 Specify explicitly that use gocql.Session.NewBatch instead of the deprecated BatchBuilder. 2020-05-29 13:05:01 +02:00
Michał Matczuk
9655ae5b49 qb: Deprecate Batch in favour of session.NewBatch
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-22 10:09:23 +02:00
Gian Lorenzo Meocci
9239d9c4b4 add UseColums function to avoid extra allocation performed by Colums function
fix name

tidy

adding SetWhere

adding SetWhere

fix go mod

fix comment style

revert go mod

Avoid to append if no needed

fix git ignore

revert change in go.sum/go.mod

adding specific benchmark
2019-12-16 11:14:11 +01:00
Michał Matczuk
1668ca5832 Updated golandci-lint to 1.21.0
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2019-11-07 16:13:50 -08:00
pierDipi
180d58ce46 Move ne comparator below eq comparator (#119)
qb: Move ne comparator below eq comparator

Signed-off-by: pierdipi <pierangelodipilato@gmail.com>
2019-11-07 06:29:21 -08:00
pierdipi
6f13526544 Add not equal comparator (!=)
The `qb.Cmp` lacks `not equal` methods related to the operator `!=`
even though the documentation
https://docs.scylladb.com/getting-started/dml/#select-statement mentions
it.

Closes: #114

Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
2019-11-03 10:01:59 +01:00
Martin Sucha
75adfd59ee Add support for BYPASS CACHE
This commit adds support for BYPASS CACHE extension that is present in
ScyllaDB since 3.1 / 2019.1.1.

https://docs.scylladb.com/getting-started/dml/#bypass-cache
2019-09-17 09:35:54 +02:00
Christoph Oelmueller
dd98b0e363 add token value comparer to TokenBuilder (#112)
qb: add token value comparer to TokenBuilder
2019-08-29 14:59:43 +02:00
Henrik Johansson
1fda6f1e29 qb: tuples now returns the correct names
The names are auto generated in the form param_0, param_1, ...
2019-05-14 11:24:25 +02:00
Henrik Johansson
219bceab51 qb: tuple support 2019-05-14 09:12:06 +02:00
Henrik Johansson
31ae81aba6 qb: json support 2019-05-14 08:52:59 +02:00
Michał Matczuk
d20fd5b39c qb: fix formatting
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2019-01-25 15:41:41 +01:00
Maxim Karelov
6100d3b4c2 Add qb.Like to query keys 2019-01-14 21:41:24 +01:00
Marian Gappa
87976451ed test(qb): Add tests for qb section (#74)
test(qb): Add missing tests for qb directory

* Add a GROUP BY test without Columns
* Add LtFunc test
* Add LtOrEqFunc test
* Add GtFunc test
* Add GtOrEqFunc test
* Add a Select with a AS between one column test
* Add a Order By DESC test
* Add Sum test
* Add Avg test
* Add Max test
* Add 2 tests for FuncColumn
* Add SetNamed test
* Add AddFunc test
* Add RemoveFunc test
* Add TTL and TimestampNamed test
* Add TTLNamed and Timestamp test
* Add TTL with negative or no duration test
* Add LtFunc test
* Add LtOrEqFunc test
* Add GtFunc test
* Add GtOrEqFunc test
* Add a Select with a AS between one column test
* Add a Order By DESC test
* Add Sum test
* Add Avg test
* Add Max test
* Add SetNamed test
* Add AddFunc test
* Add RemoveFunc test
* Add TTL and TimestampNamed test
* Add TTLNamed and Timestamp test
* Add TTL with negative or no duration test
* Add LtFunc test
* Add LtOrEqFunc test
* Add GtFunc test
* Add GtOrEqFunc test
* Add a Select with a AS between one column test
* Add a Order By DESC test
* Add Sum test
* Add Avg test
* Add Max test
* Add 2 tests for FuncColumn
* Add SetNamed test
* Add AddFunc test
* Add RemoveFunc test
* In qb/select.go, if there are no colums and the query have a GroupBy
statement then the query will be malformated.
* In qb/utils.go, refactor writeCql with a strings.Join call.

Fixes #78
2018-12-17 15:40:03 +01:00
Michal Matczuk
b7e4f7e8b7 qb: insert support order by multiple columns (#79)
Fixes #78
2018-11-15 11:55:45 +01:00
sagarafr
a503f75a9c fix(perf): Fixed performance
* Performance are better when you write columns byte by
byte rather than string generation
2018-11-09 16:32:05 +01:00
sagarafr
ec81eea1fc test(qb): Add GROUP BY test
* Add a GROUP BY test without Columns
2018-11-09 16:32:05 +01:00
sagarafr
19dedfc6a0 fix(qb): Fixed group by generation
* In qb/select.go, if there are no colums and the query have a GroupBy
statement then the query will be malformated.
* In qb/utils.go, refactor writeCql with a strings.Join call.
2018-11-09 16:32:05 +01:00
Vincent Rischmann
2f13a81c46 Add qb.ContainsKey to query keys in a map (#57)
qb: add ContainsKey and ContainsKeyNamed
2018-07-28 06:56:44 +02:00
Michał Matczuk
d5caed56c3 readme: updated docs 2018-05-25 14:20:59 +02:00
Michał Matczuk
fa402f3f0c qb: using ttl timestamp
Fixes: #40
2018-05-25 14:05:55 +02:00
Michał Matczuk
a8febbc71e testing: benchmarks moved to separate files 2018-05-23 09:39:22 +02:00
Michał Matczuk
cca99d4a42 makefile: added megacheck 2018-05-22 15:03:59 +02:00
SpiritOfWill
5526e60464 Add aggregation function to select query builder (#39)
qb: added min, max, avg, sum, and count to SelectBuilder
2018-05-15 14:07:35 +02:00
Josh Giles
12d360a0c3 Support for literals in INSERT and UPDATE and comparisons
The 'value' interface represents a CQL value for use in a comparison,
update, or intitialization operation. A consistent interface for this
allows us to easily support specifying default-named, custom-named,
literal, and evaluated-function values in all these contexts.

Parameters to Func should probably also be values to support full
composition, but that would be a breaking change because Func's
properties are exposed.

The value interface could itself be exposed if we wanted to allow
clients to pass their own values to SetValue, etc, but for now it is a
package-internal abstraction.

BLA
2018-04-20 14:52:47 +02:00
Eric Renard
9fa5432a65 fix query order when using ttl and unique 2017-12-28 11:16:54 +01:00
Josh Giles
6051038fa5 Add ColumnAs for 'SELECT col AS name' queries. (#24)
Add As helper for 'SELECT col AS name' queries

Clients could do this hackily before by manually passing "col AS name",
but it isn't clearly supported.
2017-12-15 09:53:37 +01:00
Michał Matczuk
cdb91625bf qb: batch add ability to add raw statements 2017-11-16 13:08:23 +01:00
Michał Matczuk
557674a886 qb: update builder advanced assignments 2017-09-22 09:48:19 +02:00
Michał Matczuk
fdb26806a9 qb: extracted function from cmp 2017-09-22 09:35:02 +02:00