Documentation
¶
Index ¶
- func CopyFileContents(src, dst string) (err error)
- func LoadAllFlatFiles[K comparable, T Loadable[K]](basePath string, filePattern ...string) (map[K]T, error)
- func LoadAllFlatFilesSimple[T LoadableSimple](basePath string, filePattern ...string) ([]T, error)
- func LoadFlatFile[T LoadableSimple](path string) (T, error)
- func SaveAllFlatFiles[K comparable, T Loadable[K]](basePath string, data map[K]T, saveOptions ...SaveOption) (int, error)
- func SaveFlatFile[T LoadableSimple](basePath string, dataUnit T, saveOptions ...SaveOption) error
- type FileType
- type Loadable
- type LoadableSimple
- type ReadableGroupFS
- type SaveOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFileContents ¶
func LoadAllFlatFiles ¶
func LoadAllFlatFiles[K comparable, T Loadable[K]](basePath string, filePattern ...string) (map[K]T, error)
Will check the ID() of each item to make sure it's unique
func LoadAllFlatFilesSimple ¶
func LoadAllFlatFilesSimple[T LoadableSimple](basePath string, filePattern ...string) ([]T, error)
LoadAllFlatFilesSimple doesn't require a unique Id() for each item
func LoadFlatFile ¶
func LoadFlatFile[T LoadableSimple](path string) (T, error)
func SaveAllFlatFiles ¶
func SaveAllFlatFiles[K comparable, T Loadable[K]](basePath string, data map[K]T, saveOptions ...SaveOption) (int, error)
Returns the number of files saved and error
func SaveFlatFile ¶
func SaveFlatFile[T LoadableSimple](basePath string, dataUnit T, saveOptions ...SaveOption) error
Returns the number of files saved and error
Types ¶
type Loadable ¶
type Loadable[K comparable] interface { Id() K // Must be a unique identifier for the data LoadableSimple }
type LoadableSimple ¶
type ReadableGroupFS ¶
type ReadableGroupFS interface { fs.ReadFileFS AllFileSubSystems(yield func(fs.ReadFileFS) bool) }
implements fs.ReadFileFS implements an iterator function as well
type SaveOption ¶
type SaveOption uint8
const ( // Save options SaveCareful SaveOption = iota // Save a backup and rename vs. just overwriting )
Click to show internal directories.
Click to hide internal directories.