Example #1
0
// Adds an counter operation to this mutation operation set.
func (set *MutateInBuilder) Counter(path string, delta int64, createParents bool) *MutateInBuilder {
	op := gocbcore.SubDocOp{
		Op:   gocbcore.SubDocOpCounter,
		Path: path,
	}
	op.Value, _ = json.Marshal(delta)
	if createParents {
		op.Flags &= gocbcore.SubDocFlagMkDirP
	}
	set.ops = append(set.ops, op)
	return set
}
Example #2
0
// Adds an dictionary add unique operation to this mutation operation set.
func (set *MutateInBuilder) AddUnique(path string, value interface{}, createParents bool) *MutateInBuilder {
	op := gocbcore.SubDocOp{
		Op:   gocbcore.SubDocOpArrayAddUnique,
		Path: path,
	}
	op.Value, _ = json.Marshal(value)
	if createParents {
		op.Flags &= gocbcore.SubDocFlagMkDirP
	}
	set.ops = append(set.ops, op)
	return set
}