* Update gocql version to v1.16.1 1. Update gocql to v1.16.1 2. Update golang to 1.25, since new gocql version requres it * Update golangci to 2.5.0 It is needed since 1.64.8 does not support golang 1.25. 1. Update golangci to 2.5.0 2. Migrate from golangci config v1 to v2 3. Integrate fieldaligment to golangci 4. Drop fieldaligment from Makefile 5. Address complaints
50 lines
889 B
Go
50 lines
889 B
Go
// Copyright (C) 2017 ScyllaDB
|
|
// Use of this source code is governed by a ALv2-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package gocqlx_test
|
|
|
|
import (
|
|
"github.com/gocql/gocql"
|
|
|
|
"github.com/scylladb/gocqlx/v3"
|
|
"github.com/scylladb/gocqlx/v3/qb"
|
|
)
|
|
|
|
func ExampleSession() {
|
|
cluster := gocql.NewCluster("host")
|
|
session, err := gocqlx.WrapSession(cluster.CreateSession())
|
|
if err != nil {
|
|
// handle error
|
|
}
|
|
|
|
builder := qb.Select("foo")
|
|
session.Query(builder.ToCql())
|
|
}
|
|
|
|
func ExampleUDT() {
|
|
// Just add gocqlx.UDT to a type, no need to implement marshalling functions
|
|
type FullName struct {
|
|
gocqlx.UDT
|
|
FirstName string
|
|
LastName string
|
|
}
|
|
|
|
_ = FullName{}
|
|
}
|
|
|
|
func ExampleUDT_wraper() {
|
|
type FullName struct {
|
|
FirstName string
|
|
LastName string
|
|
}
|
|
|
|
// Create new UDT wrapper type
|
|
type FullNameUDT struct {
|
|
gocqlx.UDT
|
|
*FullName
|
|
}
|
|
|
|
_ = FullNameUDT{}
|
|
}
|