persistor

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 3 Imported by: 4

README

Persistor

Persistor provides persistence for named data.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUndefinedName = errors.New("undefined name")

ErrUndefinedName happens when trying to persist data with an undefined name.

Functions

This section is empty.

Types

type HarDrivePersistor

type HarDrivePersistor struct {
	Perm fs.FileMode
}

HarDrivePersistor provides for saving named data to the hard drive.

func NewHarDrivePersistor

func NewHarDrivePersistor() HarDrivePersistor

NewHarDrivePersistor creates new HarDrivePersistor.

func (HarDrivePersistor) Persist

func (persistor HarDrivePersistor) Persist(name string, data []byte,
	path string) (err error)

Persist saves data to the "path/name" file. If a path is empty saves the file to the current directory.

type Persistor

type Persistor interface {
	// Persist persists named data to the specified path.
	Persist(name string, data []byte, path string) error
}

Persistor provides persistence for named data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL