feat: marshalers to codecs
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package codec
|
||||
|
||||
type Codec[T, U any] interface {
|
||||
Encode(T) (U, error)
|
||||
Decode(U) (T, error)
|
||||
}
|
||||
type Conversion[T, U any] = func(T) (U, error)
|
||||
|
||||
type Marshaler[T any] = Codec[T, string]
|
||||
type Codec[T any] interface {
|
||||
Encode(T) (string, error)
|
||||
Decode(string) (T, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user