24 lines
399 B
Go
24 lines
399 B
Go
|
package codec
|
||
|
|
||
|
import "io"
|
||
|
|
||
|
// Codec interface contains the encoder for response or decoder for request.
|
||
|
// Eg. gzip, flate compressions.
|
||
|
type Codec interface {
|
||
|
Encode(w io.Writer) io.Writer
|
||
|
Decode(r io.Reader) io.Reader
|
||
|
}
|
||
|
|
||
|
type codec struct {
|
||
|
}
|
||
|
|
||
|
func (_ *codec) Encode(w io.Writer) io.Writer {
|
||
|
return w
|
||
|
}
|
||
|
|
||
|
func (_ *codec) Decode(r io.Reader) io.Reader {
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
var DefaultCodec = &codec{}
|