本文整理匯總了Golang中github.com/couchbase/gocb/gocbcore.Cas函數的典型用法代碼示例。如果您正苦於以下問題:Golang Cas函數的具體用法?Golang Cas怎麽用?Golang Cas使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Cas函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: MutateIn
// Creates a sub-document mutation operation builder.
func (b *Bucket) MutateIn(key string, cas Cas, expiry uint32) *MutateInBuilder {
return &MutateInBuilder{
bucket: b,
name: key,
cas: gocbcore.Cas(cas),
expiry: expiry,
}
}
示例2: replace
func (b *Bucket) replace(key string, value interface{}, cas Cas, expiry uint32) (Cas, MutationToken, error) {
bytes, flags, err := b.transcoder.Encode(value)
if err != nil {
return 0, MutationToken{}, err
}
return b.hlpCasExec(func(cb ioCasCallback) (pendingOp, error) {
op, err := b.client.Replace([]byte(key), bytes, flags, gocbcore.Cas(cas), expiry, gocbcore.StoreCallback(cb))
return op, err
})
}
示例3: execute
func (item *RemoveOp) execute(b *Bucket, signal chan BulkOp) {
op, err := b.client.Remove([]byte(item.Key), gocbcore.Cas(item.Cas),
func(cas gocbcore.Cas, mutToken gocbcore.MutationToken, err error) {
item.Err = err
if item.Err == nil {
item.Cas = Cas(cas)
}
signal <- item
})
if err != nil {
item.Err = err
signal <- item
} else {
item.bulkOp.pendop = op
}
}
示例4: remove
func (b *Bucket) remove(key string, cas Cas) (Cas, MutationToken, error) {
return b.hlpCasExec(func(cb ioCasCallback) (pendingOp, error) {
op, err := b.client.Remove([]byte(key), gocbcore.Cas(cas), gocbcore.RemoveCallback(cb))
return op, err
})
}
示例5: touch
func (b *Bucket) touch(key string, cas Cas, expiry uint32) (Cas, MutationToken, error) {
return b.hlpCasExec(func(cb ioCasCallback) (pendingOp, error) {
op, err := b.client.Touch([]byte(key), gocbcore.Cas(cas), expiry, gocbcore.TouchCallback(cb))
return op, err
})
}