Skip to content

Commit

Permalink
Rename QueryBatch to Batch
Browse files Browse the repository at this point in the history
  • Loading branch information
willfaught committed Mar 30, 2016
1 parent a4d530c commit 261969e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestBatch(t *testing.T) {

// Exec
var s = newSession(t)
var b = s.QueryBatch(BatchKind(0))
var b = s.Batch(BatchKind(0))

if b == nil {
t.Error("Actual batch nil, expected not nil")
Expand All @@ -39,7 +39,7 @@ func TestBatch(t *testing.T) {
}

// ExecTx
b = s.QueryBatch(BatchKind(0))
b = s.Batch(BatchKind(0))
b.Query("update gockle_test.test set n = 4 where id = 1 if n = 3")

if a, err := b.ExecTx(); err == nil {
Expand Down
2 changes: 1 addition & 1 deletion examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
var mySession = &SessionMock{}

func ExampleBatch() {
var b = mySession.QueryBatch(BatchLogged)
var b = mySession.Batch(BatchLogged)

b.Query("insert into users (id, name) values (123, 'me')")
b.Query("insert into users (id, name) values (456, 'you')")
Expand Down
10 changes: 5 additions & 5 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type Session interface {
// Session to observe them.
Columns(keyspace, table string) (map[string]gocql.TypeInfo, error)

// QueryBatch returns a Batch for the Session.
QueryBatch(kind BatchKind) Batch
// Batch returns a Batch for the Session.
Batch(kind BatchKind) Batch

// QueryExec executes the query for statement and arguments.
QueryExec(statement string, arguments ...interface{}) error
Expand Down Expand Up @@ -107,8 +107,8 @@ func (m SessionMock) Columns(keyspace, table string) (map[string]gocql.TypeInfo,
return r.Get(0).(map[string]gocql.TypeInfo), r.Error(1)
}

// QueryBatch implements Session.
func (m SessionMock) QueryBatch(kind BatchKind) Batch {
// Batch implements Session.
func (m SessionMock) Batch(kind BatchKind) Batch {
return m.Called(kind).Get(0).(Batch)
}

Expand Down Expand Up @@ -183,7 +183,7 @@ func (s session) Columns(keyspace, table string) (map[string]gocql.TypeInfo, err
return types, nil
}

func (s session) QueryBatch(kind BatchKind) Batch {
func (s session) Batch(kind BatchKind) Batch {
return batch{b: s.s.NewBatch(gocql.BatchType(kind)), s: s.s}
}

Expand Down
8 changes: 4 additions & 4 deletions session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ func TestSessionMock(t *testing.T) {
{"Close", nil, nil},
{"Columns", []interface{}{"", ""}, []interface{}{map[string]gocql.TypeInfo(nil), nil}},
{"Columns", []interface{}{"a", "b"}, []interface{}{map[string]gocql.TypeInfo{"c": gocql.NativeType{}}, e}},
{"QueryBatch", []interface{}{BatchKind(0)}, []interface{}{(*batch)(nil)}},
{"QueryBatch", []interface{}{BatchKind(1)}, []interface{}{&batch{}}},
{"Batch", []interface{}{BatchKind(0)}, []interface{}{(*batch)(nil)}},
{"Batch", []interface{}{BatchKind(1)}, []interface{}{&batch{}}},
{"QueryExec", []interface{}{"", []interface{}(nil)}, []interface{}{nil}},
{"QueryExec", []interface{}{"a", []interface{}{1}}, []interface{}{e}},
{"QueryIterator", []interface{}{"", []interface{}(nil)}, []interface{}{(*iterator)(nil)}},
Expand Down Expand Up @@ -177,8 +177,8 @@ func TestSessionQuery(t *testing.T) {

exec(rowInsert)

// QueryBatch
if s.QueryBatch(BatchKind(0)) == nil {
// Batch
if s.Batch(BatchKind(0)) == nil {
t.Error("Actual batch nil, expected not nil")
}

Expand Down

0 comments on commit 261969e

Please sign in to comment.