mydb/marshal.go

17 lines
591 B
Go
Raw Permalink Normal View History

2023-09-18 15:15:42 +08:00
package mydb
// Marshaler is the interface implemented by struct fields that can transform
// themselves into values to be stored in a database.
type Marshaler interface {
// MarshalDB returns the internal database representation of the Go value.
MarshalDB() (interface{}, error)
}
// Unmarshaler is the interface implemented by struct fields that can transform
// themselves from database values into Go values.
type Unmarshaler interface {
// UnmarshalDB receives an internal database representation of a value and
// transforms it into a Go value.
UnmarshalDB(interface{}) error
}