Documentation ¶
Overview ¶
Package gorialize is an embedded database that stores Go structs serialized to gobs
Package gorialize is an embedded database that stores Go structs serialized to gobs ¶
Package gorialize is an embedded database that stores Go structs serialized to gobs ¶
Package gorialize is an embedded database that stores Go structs serialized to gobs ¶
Package gorialize is an embedded database that stores Go structs serialized to gobs ¶
Package gorialize is an embedded database that stores Go structs serialized to gobs ¶
Package gorialize is an embedded database that stores Go structs serialized to gobs
Index ¶
- func ShowAll(dirPath string) error
- func ShowOne(dirPath string, filename string) error
- type Directory
- func (dir Directory) Create(resource interface{}) error
- func (dir Directory) Delete(resource interface{}) error
- func (dir Directory) DeleteAll(resource interface{}) error
- func (dir Directory) Find(slice interface{}, clauses ...Where) error
- func (dir Directory) FindCB(resource interface{}, callback func(resource interface{}), clauses ...Where) error
- func (dir Directory) GetOwner(resource interface{}, owner interface{}) error
- func (dir Directory) Read(resource interface{}, id int) error
- func (dir Directory) ReadAll(slice interface{}) error
- func (dir Directory) ReadAllCB(resource interface{}, callback func(resource interface{})) error
- func (dir Directory) Replace(resource interface{}) error
- func (dir Directory) ReplayIndexLog()
- func (dir Directory) ResetCounter(resource interface{}) error
- type DirectoryConfig
- type Index
- type Query
- func (q *Query) ApplyWhereClauses()
- func (q *Query) BuildCounterPath()
- func (q *Query) BuildCustomDirPath(subdir string)
- func (q *Query) BuildDirPath()
- func (q *Query) BuildMetadataPath()
- func (q *Query) BuildResourcePath()
- func (q *Query) CreateMetadataDirectoryIfNotExist()
- func (q *Query) DecodeGobToResource()
- func (q *Query) DecryptGobBuffer()
- func (q *Query) DeleteFromDisk()
- func (q *Query) EncodeResourceToGob()
- func (q *Query) EncryptGobBuffer()
- func (q *Query) ExitIfDirNotExist()
- func (q *Query) ExitIfResourceNotExist()
- func (q *Query) IncrementCounterAndSetID()
- func (q Query) Log()
- func (q *Query) PassResourceToCallback(callback func(resource interface{}))
- func (q *Query) ReadCounterFromDisk()
- func (q *Query) ReadDirFileinfo()
- func (q *Query) ReadGobFromDisk()
- func (q *Query) ReflectModelNameFromType()
- func (q *Query) ReflectTypeOfResource()
- func (q *Query) SetCounterToZero()
- func (q *Query) ThwartIOBasePathEscape()
- func (q *Query) UpdateIndex(operator rune)
- func (q *Query) WriteCounterToDisk()
- func (q *Query) WriteGobToDisk()
- type Where
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Directory ¶
type Directory struct { Path string Encrypted bool Key *[32]byte Log bool Index Index IndexLogPath string }
Directory exposes methods to read and write serialized data inside a base directory.
func NewDirectory ¶
func NewDirectory(config DirectoryConfig) *Directory
NewDirectory returns a new Directory struct for the given configuration.
func (Directory) Find ¶
Find finds all serialized resource of the given slice's element type matching all provided WHERE clauses and appends them to the slice.
func (Directory) FindCB ¶
func (dir Directory) FindCB(resource interface{}, callback func(resource interface{}), clauses ...Where) error
FindCB finds all serialized resource of the given type matching all provided WHERE clauses and calls the provided callback function on each.
func (Directory) GetOwner ¶
GetOwner reads the serialized resource which owns the given resource. The resource needs to have an addressable owner ID int field which follows a 'FooID' naming convention where 'Foo' is the owner type.
func (Directory) ReadAll ¶
ReadAll reads all serialized resources of the given slice's element type and appends them to the slice.
func (Directory) ReadAllCB ¶
ReadAllCB reads all serialized resources of the given type and calls the provided callback function on each.
func (Directory) ReplayIndexLog ¶
func (dir Directory) ReplayIndexLog()
func (Directory) ResetCounter ¶
ResetCounter resets the resource counter to zero
type DirectoryConfig ¶
DirectoryConfig holds parameters to be passed to NewDirectory().
type Query ¶
type Query struct { FatalError error Dir Directory Operation string Writer bytes.Buffer GobBuffer []byte ResourceType reflect.Type Model string Resource interface{} ID int Counter int CounterPath string MetadataPath string ResourcePath string DirPath string SafeIOPath bool DirFileInfo []os.FileInfo WhereClauses []Where MatchedIDs []int IndexUpdates []string }
func (*Query) ApplyWhereClauses ¶
func (q *Query) ApplyWhereClauses()
func (*Query) BuildCounterPath ¶
func (q *Query) BuildCounterPath()
func (*Query) BuildCustomDirPath ¶
func (*Query) BuildDirPath ¶
func (q *Query) BuildDirPath()
func (*Query) BuildMetadataPath ¶
func (q *Query) BuildMetadataPath()
func (*Query) BuildResourcePath ¶
func (q *Query) BuildResourcePath()
func (*Query) CreateMetadataDirectoryIfNotExist ¶
func (q *Query) CreateMetadataDirectoryIfNotExist()
func (*Query) DecodeGobToResource ¶
func (q *Query) DecodeGobToResource()
func (*Query) DecryptGobBuffer ¶
func (q *Query) DecryptGobBuffer()
func (*Query) DeleteFromDisk ¶
func (q *Query) DeleteFromDisk()
func (*Query) EncodeResourceToGob ¶
func (q *Query) EncodeResourceToGob()
func (*Query) EncryptGobBuffer ¶
func (q *Query) EncryptGobBuffer()
func (*Query) ExitIfDirNotExist ¶
func (q *Query) ExitIfDirNotExist()
func (*Query) ExitIfResourceNotExist ¶
func (q *Query) ExitIfResourceNotExist()
func (*Query) IncrementCounterAndSetID ¶
func (q *Query) IncrementCounterAndSetID()
func (*Query) PassResourceToCallback ¶
func (q *Query) PassResourceToCallback(callback func(resource interface{}))
func (*Query) ReadCounterFromDisk ¶
func (q *Query) ReadCounterFromDisk()
func (*Query) ReadDirFileinfo ¶
func (q *Query) ReadDirFileinfo()
func (*Query) ReadGobFromDisk ¶
func (q *Query) ReadGobFromDisk()
func (*Query) ReflectModelNameFromType ¶
func (q *Query) ReflectModelNameFromType()
func (*Query) ReflectTypeOfResource ¶
func (q *Query) ReflectTypeOfResource()
func (*Query) SetCounterToZero ¶
func (q *Query) SetCounterToZero()
func (*Query) ThwartIOBasePathEscape ¶
func (q *Query) ThwartIOBasePathEscape()
func (*Query) UpdateIndex ¶
UpdateIndex updates the index based on operator: '+' = add, '-' = remove, 'x' = replace
func (*Query) WriteCounterToDisk ¶
func (q *Query) WriteCounterToDisk()
func (*Query) WriteGobToDisk ¶
func (q *Query) WriteGobToDisk()