Skip to content

Commit 80d9fe4

Browse files
committed
fix mock comments
1 parent 891125e commit 80d9fe4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

mock.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,16 @@ func (mq *MockQuery) unlock() {
107107
//
108108
// mock.On(r.Table("test")).Return(nil, errors.New("failed"))
109109
//
110-
// values of "chan interface{}" type will turn to delayed data that produce data
111-
// when there is an element available on the channel. Values of "func()
112-
// interface{}" type will produce data by calling the function. E.g.
110+
// values of `chan []interface{}` type will turn to delayed data that produce data
111+
// when there is an elements available on the channel. These elements are chunk of responses.
112+
// Values of `func() []interface{}` type will produce data by calling the function. E.g.
113+
// Closing channel or returning nil from func means end of data.
113114
//
114-
// f := func() interface{} { return 2 }
115-
// ch := make(chan interface{})
116-
// mock.On(r.Table("test")).Return([]interface{}{ch, f, 3})
115+
// f := func() []interface{} { return []interface{}{1, 2} }
116+
// mock.On(r.Table("test1")).Return(f)
117+
//
118+
// ch := make(chan []interface{})
119+
// mock.On(r.Table("test1")).Return(ch)
117120
//
118121
// Running the query above will block until a value is pushed onto ch.
119122
func (mq *MockQuery) Return(response interface{}, err error) *MockQuery {

0 commit comments

Comments
 (0)