Bootstrap copied BFF and local accounts with public Sendico contracts (#34)
This commit is contained in:
1 parent
67dc5b5b1e
commit
7062672a87
556 files changed
+42291
-777
No files matched your search
@@ -0,0 +1,23 @@
|
||||
package builder
|
||||
|
||||
// UnwindOption is a functional option for configuring the $unwind stage.
|
||||
type UnwindOption func(*UnwindOpts)
|
||||
|
||||
type UnwindOpts struct {
|
||||
PreserveNullAndEmptyArrays bool
|
||||
IncludeArrayIndex string
|
||||
}
|
||||
|
||||
// WithPreserveNullAndEmptyArrays tells $unwind to keep docs where the array is null/empty.
|
||||
func WithPreserveNullAndEmptyArrays() UnwindOption {
|
||||
return func(o *UnwindOpts) {
|
||||
o.PreserveNullAndEmptyArrays = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithIncludeArrayIndex adds an array‐index field named idxField to each unwound doc.
|
||||
func WithIncludeArrayIndex(idxField string) UnwindOption {
|
||||
return func(o *UnwindOpts) {
|
||||
o.IncludeArrayIndex = idxField
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user