Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDatabase = fmt.Errorf("%w: database", ErrHareBrain)
View Source
var ErrHareBrain = &HarebrainError{msg: "harebrain"}
View Source
var ErrNoSuchRecord = errors.New("no such record")
View Source
var ErrNoSuchTable = errors.New("no such table")
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { Folder string Filesystem realfs.WritableFs }
a Database is a root folder that acts as a container for [Table]s
func NewDatabase ¶
func NewDatabase() *Database
type EncodeHasher ¶
type EncodeHasher interface { Hash() string encoding.BinaryMarshaler encoding.BinaryUnmarshaler }
an EncodeHasher is a record in a table in a harebrain database
type HarebrainError ¶
type HarebrainError struct {
// contains filtered or unexported fields
}
func (*HarebrainError) Error ¶
func (h *HarebrainError) Error() string
type JsonRecord ¶
type JsonRecord[T any] struct { Data T }
JsonRecord is an EncodeHasher that serializes to JSON
func (*JsonRecord[T]) Hash ¶
func (j *JsonRecord[T]) Hash() string
Hash produces random looking hex, plus a ".json" extension
func (*JsonRecord[T]) MarshalBinary ¶
func (j *JsonRecord[T]) MarshalBinary() ([]byte, error)
MarshalBinary marshals to JSON
func (*JsonRecord[T]) UnmarshalBinary ¶
func (j *JsonRecord[T]) UnmarshalBinary(p []byte) error
UnmarshalBinary unmarshals from JSON
Click to show internal directories.
Click to hide internal directories.