mirror of
https://github.com/goccy/go-yaml.git
synced 2025-12-08 06:09:57 +00:00
18 lines
291 B
Go
18 lines
291 B
Go
|
|
package yaml
|
||
|
|
|
||
|
|
import "context"
|
||
|
|
|
||
|
|
type ctxMergeKey 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
|
||
|
|
}
|