17 lines
591 B
Go
17 lines
591 B
Go
|
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
|
||
|
}
|