mirror of
https://github.com/owncloud/ocis
synced 2026-04-25 17:25:21 +02:00
This updates the ownCloud Reva dependency to commit `82c22e954c1cdabb62a14fbe5c1a4ec3e1dabd45`.
Changelog: cb98fe521d...82c22e954c
38 lines
735 B
Go
38 lines
735 B
Go
package yaml
|
|
|
|
import "context"
|
|
|
|
type (
|
|
ctxMergeKey struct{}
|
|
ctxAnchorKey struct{}
|
|
)
|
|
|
|
func withMerge(ctx context.Context) context.Context {
|
|
return context.WithValue(ctx, ctxMergeKey{}, true)
|
|
}
|
|
|
|
func isMerge(ctx context.Context) bool {
|
|
v, ok := ctx.Value(ctxMergeKey{}).(bool)
|
|
if !ok {
|
|
return false
|
|
}
|
|
return v
|
|
}
|
|
|
|
func withAnchor(ctx context.Context, name string) context.Context {
|
|
anchorMap := getAnchorMap(ctx)
|
|
if anchorMap == nil {
|
|
anchorMap = make(map[string]struct{})
|
|
}
|
|
anchorMap[name] = struct{}{}
|
|
return context.WithValue(ctx, ctxAnchorKey{}, anchorMap)
|
|
}
|
|
|
|
func getAnchorMap(ctx context.Context) map[string]struct{} {
|
|
v, ok := ctx.Value(ctxAnchorKey{}).(map[string]struct{})
|
|
if !ok {
|
|
return nil
|
|
}
|
|
return v
|
|
}
|