Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
df2b455647 | |||
8332d628b4 |
8
json.go
8
json.go
@@ -57,8 +57,8 @@ func (c *jsonCodec) Marshal(v interface{}, opts ...codec.Option) ([]byte, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
marshalOptions := DefaultMarshalOptions
|
marshalOptions := DefaultMarshalOptions
|
||||||
if c.opts.Context != nil {
|
if options.Context != nil {
|
||||||
if f, ok := c.opts.Context.Value(marshalOptionsKey{}).(JsonMarshalOptions); ok {
|
if f, ok := options.Context.Value(marshalOptionsKey{}).(JsonMarshalOptions); ok {
|
||||||
marshalOptions = f
|
marshalOptions = f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,8 +95,8 @@ func (c *jsonCodec) Unmarshal(b []byte, v interface{}, opts ...codec.Option) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
unmarshalOptions := DefaultUnmarshalOptions
|
unmarshalOptions := DefaultUnmarshalOptions
|
||||||
if c.opts.Context != nil {
|
if options.Context != nil {
|
||||||
if f, ok := c.opts.Context.Value(unmarshalOptionsKey{}).(JsonUnmarshalOptions); ok {
|
if f, ok := options.Context.Value(unmarshalOptionsKey{}).(JsonUnmarshalOptions); ok {
|
||||||
unmarshalOptions = f
|
unmarshalOptions = f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,6 @@ func UnmarshalOptions(o JsonUnmarshalOptions) codec.Option {
|
|||||||
|
|
||||||
type marshalOptionsKey struct{}
|
type marshalOptionsKey struct{}
|
||||||
|
|
||||||
func MarshalOptions(o JsonUnmarshalOptions) codec.Option {
|
func MarshalOptions(o JsonMarshalOptions) codec.Option {
|
||||||
return codec.SetOption(marshalOptionsKey{}, o)
|
return codec.SetOption(marshalOptionsKey{}, o)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user