Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6ed0b0e090 | ||
533b265d19 |
@ -1,5 +1,5 @@
|
|||||||
# Micro
|
# Micro
|
||||||
![Coverage](https://img.shields.io/badge/Coverage-44.9%25-yellow)
|
![Coverage](https://img.shields.io/badge/Coverage-45.1%25-yellow)
|
||||||
|
|
||||||
Micro is a standard library for microservices.
|
Micro is a standard library for microservices.
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ package codec
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -66,10 +68,10 @@ func (m *RawMessage) MarshalYAML() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalYAML sets *m to a copy of data.
|
// UnmarshalYAML sets *m to a copy of data.
|
||||||
func (m *RawMessage) UnmarshalYAML(data []byte) error {
|
func (m *RawMessage) UnmarshalYAML(n *yaml.Node) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return errors.New("RawMessage UnmarshalYAML on nil pointer")
|
return errors.New("RawMessage UnmarshalYAML on nil pointer")
|
||||||
}
|
}
|
||||||
*m = append((*m)[0:0], data...)
|
*m = append((*m)[0:0], []byte(n.Value)...)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package codec
|
package codec
|
||||||
|
|
||||||
|
import "gopkg.in/yaml.v3"
|
||||||
|
|
||||||
// Frame gives us the ability to define raw data to send over the pipes
|
// Frame gives us the ability to define raw data to send over the pipes
|
||||||
type Frame struct {
|
type Frame struct {
|
||||||
Data []byte
|
Data []byte
|
||||||
@ -26,8 +28,9 @@ func (m *Frame) MarshalYAML() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalYAML set frame data
|
// UnmarshalYAML set frame data
|
||||||
func (m *Frame) UnmarshalYAML(data []byte) error {
|
func (m *Frame) UnmarshalYAML(n *yaml.Node) error {
|
||||||
return m.Unmarshal(data)
|
m.Data = []byte(n.Value)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProtoMessage noop func
|
// ProtoMessage noop func
|
||||||
|
Loading…
x
Reference in New Issue
Block a user