Skip to content

Instantly share code, notes, and snippets.

@asim
Created November 27, 2015 23:38
Show Gist options
  • Save asim/acbc9f208232cc40f074 to your computer and use it in GitHub Desktop.
Save asim/acbc9f208232cc40f074 to your computer and use it in GitHub Desktop.
Go-micro Codec Interface
const (
Error MessageType = iota
Request
Response
Publication
)
type Codec interface {
Encoder
Decoder
Close() error
}
type Encoder interface {
ReadHeader(*Message) error
ReadBody(interface{}) error
}
type Decoder interface {
WriteHeader(*Message) error
WriteBody(interface{}) error
}
type Message struct {
Id uint64
Type MessageType
Target string
Method string
Error string
Headers map[string]string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment