Exemple #1
0
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
}
Exemple #2
0
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
}