BindStructMap
This commit is contained in:
@@ -4,6 +4,7 @@ package gocqlx_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gocql/gocql"
|
||||
"github.com/scylladb/gocqlx"
|
||||
@@ -134,6 +135,17 @@ func TestExample(t *testing.T) {
|
||||
mustExec(q.Query)
|
||||
}
|
||||
|
||||
// Insert with TTL
|
||||
{
|
||||
q := Query(qb.Insert("gocqlx_test.person").Columns("first_name", "last_name", "email").TTL().ToCql())
|
||||
if err := q.BindStructMap(p, map[string]interface{}{
|
||||
"_ttl": qb.TTL(86400 * time.Second),
|
||||
}); err != nil {
|
||||
t.Fatal("bind:", err)
|
||||
}
|
||||
mustExec(q.Query)
|
||||
}
|
||||
|
||||
// Update
|
||||
{
|
||||
p.Email = append(p.Email, "patricia1.citzen@gocqlx_test.com")
|
||||
|
||||
Reference in New Issue
Block a user