issue_296 #300

Merged
vtolstov merged 4 commits from devstigneev/micro:issue_296 into master 2024-02-28 23:52:31 +03:00
Showing only changes of commit d667bbee0c - Show all commits

View File

@ -157,6 +157,22 @@ func Metadata(md metadata.Metadata) Option {
} }
} }
func MetadataAny(md any) Option {
result := metadata.Metadata{}
switch vt := md.(type) {
case metadata.Metadata:
result = metadata.Copy(vt)
case []string:
for index := 0; index < len(vt); index += 2 {
result[vt[index]] = result[vt[index]]
}
}
return func(src interface{}) error {
return Set(src, result, ".Metadata")
}
}
// Namespace to use // Namespace to use
func Namespace(ns string) Option { func Namespace(ns string) Option {
return func(src interface{}) error { return func(src interface{}) error {