Skip to content

Releases: scylladb/gocqlx

v2.0.3

21 May 12:06
Compare
Choose a tag to compare

This release adds NewSession function for easier integration with codebases using *gocql.Session.

v2.0.2

29 Apr 08:55
Compare
Choose a tag to compare
Update tests to use v2

Signed-off-by: Michał Matczuk <michal@scylladb.com>

v2.0

23 Apr 15:18
Compare
Choose a tag to compare

Lightweight Transactions (aka CAS)

Requires Scylla 4.0 or Scylla 3.3 with --experimental flag enabled.

The "Get" function variant is added: GetCAS, GetCASRelease, these functions returns the "applied" indicator. Similarly there are ExecCAS, ExecCASRelease functions if you are not interested in preimage. See a lock example in example_test.go.

User Defined Types Automation

You can now add UDT trait to a type by adding a single line of code:

type Coordinates struct {
	gocqlx.UDT
	X int
	Y int
}

You can also add UDT trait to an alien type by embedding a pointer to it:

type CoordinatesUDT struct {
	gocqlx.UDT
	*coordinates
}

See the full runnable examples in example_test.go.

New Session API

Instead of (old format):

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

we can now use session "Query" function to return Queryx instance:

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

It requires wrapping the session on creation:

// Create gocql cluster.
cluster := gocql.NewCluster(hosts...)
// Wrap session on creation, gocqlx session embeds gocql.Session pointer. 
session, err := gocqlx.WrapSession(cluster.CreateSession())
if err != nil {
	t.Fatal(err)
}

User Defined Types are Scanable

Types implementing UDT marshalling functions are now "scanable", which means you can use them in "Get" and "Select" function families, for queries that return a single column. StructOnly modifier was added to Iterx. When enabled you can use the UDT enabled types as normal structs.

API incompatibilities

  • Iter(q *gocql.Query) *Iterx constructor is removed, one should use Queryx::Iter instead
    API
  • Migrate package uses now gocqlx.Session in place of *gocql.Session

Deprecated APIs

  • Query(q *gocql.Query, names []string) *Queryx constructor is deprecated, one should use the new Session
  • qb Batch is deprecated

v1.5.0

10 Apr 09:54
Compare
Choose a tag to compare

This release:

  • Extends table module with Builders for Update and Delete, and exports PK comparator by @GingerMoon

v1.4.0

25 Feb 14:41
Compare
Choose a tag to compare

This release:

v1.3.3

07 Jan 15:05
Compare
Choose a tag to compare

This release solves a problem with go mod parsing #129.
Functionally it's the same as 1.3.2.

v1.3.2

02 Jan 08:42
Compare
Choose a tag to compare

New in this release:

  • General maintenance
  • Iterx inherit mapper from Query
  • qb: Reuse slices to avoid allocations by @meox
  • qb: Added not equal comparators (!=) by @pierDipi
  • qb: Added support for BYPASS CACHE @martin-sucha
  • qb: Added token value comparer to TokenBuilder @zwopir

v1.3.1

03 Jun 09:31
Compare
Choose a tag to compare

This is a maintenance release to fix a bug when iterating over paged result sets.

The server is allowed to return empty pages even when there are more rows
available. We used assume this was not the case and in certain circumstances
iteration was terminated prematurely. We are now handling this case by letting
the gocql driver handle it.

PR: #105

v1.3.0

15 May 11:59
Compare
Choose a tag to compare

This release adds Tuple (#102) and JSON (#103) support.

v1.2.2

28 Mar 13:00
a1f46ec
Compare
Choose a tag to compare

This release upgrades go-reflectx to take advantage of recent performance enhancements.