Hi.
I am using go-couchbase to update data to couchbase, however, I have problem in how to use the callback function.
The fuction Update require me to pass a callback function in which should be UpdateFunc
func (b *Bucket) Update(k string, exp int, callback UpdateFunc) error
So that's what I have done
First, I declared a type UpdateFunc:
type UpdateFunc func(current []byte) (updated []byte, err error)
Then in the code, I add the following lines:
fn := UpdateFunc{func(0){}}
and then call the Update function:
bucket.Update("12345",0,fn()}
But the Go says the following error:
syntax error: unexpected literal 0, expecting ) for this line fn := UpdateFunc{func(0) { } }
So what I am doing wrong? So how can I make the callback function work ?
Thanks