36 Commits

Author SHA1 Message Date
84c58f45a3 Delete everything except query builder 2025-11-20 16:09:09 +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
25cee51cac Upgrade gocql to 1.15.3 (#343)
gocql 1.15.3 brings new APIs for `gocql.Batch` and `gocql.Query`:
- `SetRequestTimeout`
- `GetRequestTimeout`

So, this change adds relative APIs to the `gocqlx.Batch` and `gocqlx.Queryx`.
2025-09-08 06:25:00 -04:00
Dmitry Kropachev
a8d276713e Update gocql to v1.15.1 (#323)
* Update gocql to v1.15.1

* Add SetHostID to Queryx and Batch
2025-06-10 13:24:39 -04:00
sylwiaszunejko
7072863b0c Replace Unsafe with Strict mechanism
Previously by default the presence of a missing field in
a udt would result in an error reported. The Unsafe
mechanism could be used to ignore these fields.

This PR changes the default behavior to ignoring missing
fields and only reporting an error if Strict mode is used.
This approach is in line with the gocql.
2024-06-25 15:29:10 +02:00
Dmitry Kropachev
6a60650668 Marshal/Unmarshal missing UDT fields as null instead of failing in unsafe mode
We can't return an error in case a field is added to the UDT,
otherwise existing code would break by simply altering the UDT in the
database. For extra fields at the end of the UDT put nulls to be in
line with gocql, but also python-driver and java-driver.

In gocql it was fixed in d2ed1bb74f
2024-06-25 12:32:16 +02:00
Dmitry Kropachev
c6f942afc7 Introduce Unsafe method on Queryx
It enables local control over `unsafe` mode for .Bind methods of `Queryx` and iterators
spawn by it.
2024-06-25 12:32:16 +02:00
Dmitry Kropachev
ab80d70106 Update golangci-lint and turn it on in CI 2024-06-19 08:08:54 +02:00
Kevin Barbour
5cffcdf5e4 queryx: add note to ExecCAS docs
relates to: #228
2022-04-25 11:08:48 +02:00
Drahflow
4c67e8b586 Force metadata retrieval for CAS queries
... otherwise the [applied] column is not noticed
and setting of Iter.applied is skipped.
2022-02-21 16:30:17 +01:00
Nikita Karmatskikh
504f6523d9 queryx: add binding transformer 2021-11-26 10:16:34 +01:00
Nikita Karmatskikh
5e98fb6f71 queryx: make bindStructArgs and bindMapArgs as methods 2021-11-26 10:16:34 +01:00
ok32
01be91c745 GetCAS: check if the query has a build error before trying to execute it 2021-05-04 10:57:09 +02:00
xiang.wang
b79c395c11 Specify explicitly that use gocqlx.Session.Qury API insteawd of the deprecated Query API 2020-05-29 12:39:24 +02:00
Michał Matczuk
0675f72f4f Updated examples and README for 2.0
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-23 16:23:30 +02:00
Maciej Zimnoch
52c5f6873a queryx: Added CAS functions (#98)
Added ExecCAS, ExecCASRelease, GetCAS, GetCASRelease functions
suitable for INSERT ... IF NOT EXISTS and UPDATE's containing IF statement.
Functions returns information wheter query was applied or not, together
with pre-image.

Fixes #98
2020-04-22 11:57:35 +02:00
Michał Matczuk
95d96fa939 Merge pull request #3 from hailocab/upstream-merge
Upstream merge
Add Session wrapper

With this patch we can now use gocqlx like:

```
session.Query(`SELECT * FROM struct_table`, nil).Get(&v)
```

instead of (old format):

```
gocqlx.Query(session.Query(`SELECT * FROM struct_table`), nil).Get(&v)
```

Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-21 10:07:45 +02:00
Michał Matczuk
ab279e68ed Automated UDT support
This patch adds the power of GocqlX to UDTs.
Now you can make a struct be UDT compatible by adding a single line.

```
type FullName struct {
	gocqlx.UDT
	FirstName string
	LastName  string
}
```

Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-21 09:41:41 +02:00
Martin Sucha
a08a66ee85 iterx: Allow forcing scanning as struct
We have a structure type that implements UnmarshalCQL method.
We use it to unmarshal a user defined type. We also want to use the same struct for scanning an entire row.

There is StructScan method available in gocqlx for this purpose when iterating over rows, but no equivalent when doing a Select.
This commit introduces the possibility when doing select/get as well.

Co-authored-by: Michał Matczuk <michal@scylladb.com>
2020-04-17 09:26:48 +02:00
Michał Matczuk
a57d58f38f Iterx inherit mapper from Queryx
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2019-11-08 23:57:04 +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
Michał Matczuk
2348379a4f reflectx: use github.com/scylladb/go-reflectx
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2019-01-25 15:41:41 +01:00
Michał Matczuk
8ea6a9d5f5 queryx: added Iter function
Fixes #64
2018-10-23 16:32:30 +02:00
Michał Matczuk
bbb21ea945 CompileNamedQuery: fix doc string to include escaping ::
Fixes #56
2018-10-23 15:52:54 +02:00
Michał Matczuk
aef66f4663 reflectx: code ported from github.com/jmoiron/sqlx a2429ba
Depending on sqlx makes users pull SQL related code that is usually not
needed. Tools like dep make it easier by explicitly listing relevant
subpackages but the code needs to be downloaded anyway.
2018-05-25 11:17:07 +02:00
Michał Matczuk
6e4a05de42 queryx: added Get, GetRelease, Select and SelectRelease helper functions
I have piggy backed with this change some docs update.

Fixes #41
2018-05-23 11:25:00 +02:00
Justin Nuß
439bce4bdc avoid one allocation when binding structs 2017-12-15 09:51:32 +01:00
Michał Matczuk
9e40fcfed4 license: added license header 2017-09-21 21:43:27 +02:00
Michał Matczuk
46603152a1 error: %s replaced with %q in missing field errors 2017-09-21 21:29:44 +02:00
Michał Matczuk
1da2c19fe8 query: Query return ptr 2017-08-24 12:32:37 +02:00
Michał Matczuk
de9287b6e7 queryx: exec release 2017-08-22 11:36:21 +02:00
Michał Matczuk
fd4e0be6c8 BindStruct, BindStructMap, BindStructMap returns *Queryx 2017-08-02 11:16:31 +02:00
Michał Matczuk
711e3369d6 BindStructMap 2017-08-02 10:24:27 +02:00
Michał Matczuk
41bb8def2a qb: doc 2017-07-31 15:30:26 +02:00
Michał Matczuk
871a3693ad compile named query: drop of loop over runes 30% performance improvement 2017-07-26 09:10:35 +02:00
Michał Matczuk
f3b13bf31b queryx 2017-07-25 14:12:07 +02:00