Skip to content

Releases: scylladb/gocqlx

v3.0.4

13 Sep 14:05
101d498

Choose a tag to compare

What's Changed

Full Changelog: v3.0.3...v3.0.4

v3.0.3

19 Aug 11:26
19efa3f

Choose a tag to compare

What's Changed

Full Changelog: v3.0.2...v3.0.3

v3.0.2

10 Jun 17:34
a8d2767

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v3.0.1...v3.0.2

Release v3.0.1

20 Sep 12:16

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v3.0...v3.0.1

Release v3.0

15 Jul 09:05

Choose a tag to compare

This major release introduces significant changes. We have switched from gocql/gocql to scylladb/gocql and replaced the Unsafe mechanism with the Strict mechanism to ensure compatibility with the default behavior of gocql. These two changes are breaking changes, which is why this release is classified as a major update. Additionally, several smaller fixes and features have been added.

What's Changed

New Contributors

Full Changelog: v2.8.0...v3.0

Release 2.8.0

11 Jan 13:04

Choose a tag to compare

The release adds support for schemagen to generate structs in table model, as well as username/password authentication to schemagen.

What's Changed

New Contributors

Full Changelog: v2.7.0...v2.8.0

Release 2.7.0

21 Feb 11:34

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.6.0...v2.7.0

Release 2.6.0

26 Nov 11:13

Choose a tag to compare

This release adds automatic support for gocql.UnsetValue.
This is a special value representing not set i.e. not resulting in any change to the existing value.
This is great for PATCHING entities, you can have a single prepared statement that can be reused to update any combination of the fields.

Example:

The following example upserts Operation not changing the Fee field.

	// Insert operation with empty fee.
	insertQuery = insertOperation.Query(session).
		WithBindTransformer(gocqlx.UnsetEmptyTransformer).
		BindStruct(Operation{
			ID:        "2",
			ClientID:  "42",
			Type:      "Input",
			PaymentID: "1",
			Fee:       nil,
		})
	if err := insertQuery.ExecRelease(); err != nil {
		t.Fatal("ExecRelease() failed:", err)
	}

Also, the bind transformer can be set globally for the whole application.

	// Set default transformer to avoid setting it for each query.
	gocqlx.DefaultBindTransformer = gocqlx.UnsetEmptyTransformer

What's Changed

  • qb: add named limit and per partition limit clauses by @N1cOs in #208
  • queryx: unset empty values by @N1cOs in #206

New Contributors

Full Changelog: v2.5.0...v2.6.0

Release 2.5.0

17 Nov 11:34

Choose a tag to compare

Schemagen 🥇

This release adds schemagen tool that generates goclqx table models based on database schema.

Example:

Running the following command for examples keyspace:

$GOBIN/schemagen -cluster="127.0.0.1:9042" -keyspace="examples" -output="models" -pkgname="models"

Generates models/models.go as follows:

// Code generated by "gocqlx/cmd/schemagen"; DO NOT EDIT.

package models

import "github.com/scylladb/gocqlx/v2/table"

// Table models.
var (
	Playlists = table.New(table.Metadata{
		Name: "playlists",
		Columns: []string{
			"album",
			"artist",
			"id",
			"song_id",
			"title",
		},
		PartKey: []string{
			"id",
		},
		SortKey: []string{
			"title",
			"album",
			"artist",
		},
	})

	Songs = table.New(table.Metadata{
		Name: "songs",
		Columns: []string{
			"album",
			"artist",
			"data",
			"id",
			"tags",
			"title",
		},
		PartKey: []string{
			"id",
		},
		SortKey: []string{},
	})
)

Installation

go get -u "github.com/scylladb/gocqlx/v2/cmd/schemagen"

What's Changed

New Contributors

Full Changelog: v2.4.0...v2.5.0

Release 2.4.0

30 Apr 09:41

Choose a tag to compare

This release adds support for embedding migration files inside binary with go:embed.
It requires go 1.16+.

Example:

Embed all cql files in your migration directory.

//go:embed *.cql
var Files embed.FS

Pass the FS to migration function.

if err := migrate.FromFS(context.Background(), session, cql.Files); err != nil {
	// handle error
}

The migrate.Migrate function is now deprecated.