Skip to content

Release 2.5.0

Compare
Choose a tag to compare
@mmatczuk mmatczuk released this 17 Nov 11:34
· 34 commits to master since this release

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