issue_296 #300

Merged
vtolstov merged 4 commits from devstigneev/micro:issue_296 into master 2024-02-28 23:52:31 +03:00
2 changed files with 2 additions and 8 deletions
Showing only changes of commit e6feca2fb1 - Show all commits

View File

@ -151,13 +151,7 @@ func ContentType(ct string) Option {
}
// Metadata pass additional metadata
func Metadata(md metadata.Metadata) Option {
return func(src interface{}) error {
return Set(src, metadata.Copy(md), ".Metadata")
}
}
func MetadataAny(md any) Option {
func Metadata(md any) Option {
result := metadata.Metadata{}
switch vt := md.(type) {
case metadata.Metadata:

View File

@ -141,7 +141,7 @@ func TestMetadataAny(t *testing.T) {
t.Run(tt.Name, func(t *testing.T) {
src := &s{}
var opts []options.Option
opts = append(opts, options.MetadataAny(tt.Data))
opts = append(opts, options.Metadata(tt.Data))
for _, o := range opts {
if err := o(src); err != nil {
t.Fatal(err)