325 Commits

Author SHA1 Message Date
ok32
01be91c745 GetCAS: check if the query has a build error before trying to execute it 2021-05-04 10:57:09 +02:00
Michał Matczuk
d123214401 migrate: refactor examples to use the new FromFS function 2021-04-30 11:36:21 +02:00
Michał Matczuk
fe1498fe13 migrate: add support for new Go io/fs.FS
This patch adds FromFS function and lets you use the new go:embed directive to add the migration files to the binary.
Also, migration tests use an in memory FS impl instead of working with tmp directories.
2021-04-30 11:19:14 +02:00
Michał Matczuk
7980a955be github: force Go 1.16 or higher 2021-04-30 11:19:14 +02:00
Michał Matczuk
c51d7713a2 go mod update go to 1.16 2021-04-30 11:19:14 +02:00
Michał Matczuk
412899a9b2 example_test: lwtLock, add serial consistency 2020-12-03 13:37:56 +01:00
Michał Matczuk
233aa4295f example_test: Modernize with using Query(session) pattern 2020-12-03 13:37:56 +01:00
Michał Matczuk
1b6e643584 migrate: Add example 2020-12-03 13:37:56 +01:00
Michał Matczuk
9dd79fc620 migrate: Add CallbackRegister 2020-12-03 13:37:56 +01:00
Michał Matczuk
fbe7bc45b5 migrate: Remove "failed" wording from error messages 2020-12-03 13:37:56 +01:00
Michał Matczuk
d25129e2fc migrate: Add support CQL comment callbacks
This patch adds a new migration event type CallComment that it triggered by adding `-- CALL <name>;` comment in a CQL file.

Fixes #101
2020-12-03 13:37:56 +01:00
Michał Matczuk
41e4a3fa11 README: Remove leading spaces 2020-12-03 13:37:56 +01:00
Michał Matczuk
69f6f201f2 dbutil: RewriteTable, generalize table.RewriteRows to copy from source table to destination table with row transformation 2020-12-03 10:48:23 +01:00
Michał Matczuk
13ef8ceaf1 table: Add RewriteRows 2020-10-30 16:38:07 +01:00
Michał Matczuk
bc762ebc01 table: Add SelectAll 2020-10-30 16:38:07 +01:00
Michał Matczuk
5a48acca36 table: Add InsertBuilder 2020-10-30 16:38:07 +01:00
Michał Matczuk
7d3868d381 github: Migrate from travis to GH actions 2020-10-30 16:38:07 +01:00
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