Commit Graph

308 Commits

Author SHA1 Message Date
Maciej Zimnoch
4ea6f42a51 Added Context variants of Query functions 2020-06-19 11:13:21 +02:00
Maciej Zimnoch
8af6506cde table: add GetQuery shortcut to Queryx 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
Maciej Zimnoch
564db08698 table: Added shortcuts to Queryx
These shortucuts allows to write shorter more straightforward code.
It allows to write:

```
clusters.InsertQuery(session).BindStruct(r).ExecRelease()
```

instead of:

```
tmt, names := clusters.Insert()
session.Query(stmt,names).BindStruct(r).ExecRelease()
```
2020-06-17 16:44:48 +02:00
Michal Jan Matczuk
009b5ec4b5 Update README.md 2020-06-09 09:19:13 +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
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
ae6d066255 Add NewSession function
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-05-21 14:04:36 +02:00
Michal Jan Matczuk
a721151829 Update README.md 2020-05-13 14:09:00 +02:00
Michał Matczuk
cea42f14c7 Update tests to use v2
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-29 10:54:39 +02:00
Michal Jan Matczuk
e90337b9ca Update README.md 2020-04-29 09:35:08 +02:00
Michal Jan Matczuk
fa54f5347b Add go module v2 suffix
Fixes #153
2020-04-29 09:27:42 +02:00
Michal Jan Matczuk
507391a34c Update README.md 2020-04-23 17:44:01 +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
Michał Matczuk
227d152ac2 iterx: Minor test refactoring
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-22 12:16:33 +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
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
Michał Matczuk
33e08981ad queryx: Add test to check that all methods are wrapped
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-21 15:35:39 +02:00
Michał Matczuk
6f3b4bc8e5 tavis: Bump Scylla version to 4.0.rc1
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-21 15:13:16 +02:00
Michał Matczuk
33ae600ba4 Modernised tests
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-21 11:36:42 +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
Michał Matczuk
2569c3dd8f makefile: moved running Scylla to makefile target
- Modernised Makefile
- Scylla and go bench run on separate CPUs

Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-17 15:13:21 +02:00
Michał Matczuk
1e766b10c9 Update benchmark results in README
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-17 15:08:25 +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
a9ce16bfc6 iterx: Refactor DefaultUnsafe handling
Assign unsafe from DefaultUnsafe and simplify condition.

Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-16 13:04:13 +02:00
Michał Matczuk
92c739c2db makefile: Update golang CI lint
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-16 12:39:34 +02:00
Michał Matczuk
e796a82d11 makefile: Disable test cache
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-16 12:39:34 +02:00
Michał Matczuk
17f58c5605 travis: Add scylla version env variable
- Added SCYLLA_VERSION=latest

Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-16 12:39:34 +02:00
Michał Matczuk
710f921b79 Remove deprecated top level functions Get and Select
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-16 12:39:34 +02:00
Michał Matczuk
7c0a35d621 iterx: Move isScannable to Iterx
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-16 12:39:34 +02:00
Michał Matczuk
bd53297a6c iterx: Change field order
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-16 12:39:34 +02:00
Michał Matczuk
e5688d15a8 iterx: Fix a typo in test
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-16 12:39:34 +02:00
Michał Matczuk
2c5ac087ec iterx: Improve error messages 2020-04-16 12:39:34 +02:00
Michał Matczuk
4b8b455fa0 benchmark: Update benchmark
- Run on a single CPU
- Moved query initialisation outside the timed zone

Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-04-16 12:39:34 +02:00
xiang.wang
27c388ea32 table: Added PrimaryKeyCmp() which returns copy of table's primaryKeyCmp. 2020-04-08 09:23:19 +02:00
xiang.wang
fc0b7be8ab table: Added cql.builders for insert, update, delete to enable table batch timestamp at statement granularity. 2020-03-19 09:40:56 +01:00
Aleksandar Jankovic
ab2a96d9f3 table: fix data race in select builder usage
When table is used with SelectBuilder it triggers data race on Where()
condition usage.

This change copies underlining slices on table creation to allow safe
concurrent usage of the table.
2020-02-25 16:36:59 +02:00
Guy
c36e6c5e66 added training information to readme file 2020-02-10 09:38:36 +01:00
Daniel Lohse
ed4fad9742 Add DefaultAwaitSchemaAgreement option (disabled by default)
Depending on what is set, schema agreement is checked before each file or before each statement.
Awaiting schema agreement after every migration has run is always done.
2020-02-05 15:23:06 +01:00
Daniel Lohse
0ee9ef8bda Update gocql version to the latest master 2020-02-05 15:23:06 +01:00
Daniel Lohse
12fcad241d Fix resetting DefaultUnsafe option after the DefaultUnsafe select test 2020-01-15 16:31:47 +01:00
Daniel Lohse
a471f98eed Add DefaultUnsafe global
Setting it to true will enable Iter's `Unsafe()` behavior for all queries.
2020-01-15 15:24:45 +01:00
Michał Matczuk
0f06ab790c go mod tidy
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2020-01-07 16:01:17 +01:00
Michał Matczuk
3cba305eef Revert "Replace gocql => github.com/scylladb/gocql"
This reverts commit 3e60935d2a.
2020-01-07 15:59:15 +01:00
Gian Lorenzo Meocci
45d3524bc1 remove empty line in git ignore 2019-12-16 11:14:11 +01: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
a57d58f38f Iterx inherit mapper from Queryx
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2019-11-08 23:57:04 +01:00
Michał Matczuk
1f3032a787 Travis updated Go and Scylla version
Signed-off-by: Michał Matczuk <michal@scylladb.com>
2019-11-07 16:13:50 -08:00