fs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StorageFilenameFormat = "2006-01-02.md"
	StorageGlob           = "*.md"

	ErrUnableToFindMetadataSection = fmt.Errorf("unable to find metadata yaml at header of entry")
)

Functions

This section is empty.

Types

type Store

type Store struct {
	*sync.Mutex

	Directory string `yaml"directory" validate:"required,dir"`
	// contains filtered or unexported fields
}

func New

func New(dir string, createDirIfMissing bool) (*Store, error)

func (*Store) Count

func (x *Store) Count() int

func (*Store) CreateOrUpdateEntry

func (x *Store) CreateOrUpdateEntry(e *v1.Entry) (*v1.Entry, error)

func (*Store) Get

func (x *Store) Get(id v1.ID, forceRead bool) (*v1.Entry, error)

Get loads an entry from disk and caches it in the entry map

func (*Store) HasEntry

func (x *Store) HasEntry(id v1.ID) bool

func (*Store) ListAll

func (x *Store) ListAll() ([]*v1.Entry, error)

ListAll returns entries in newest to oldest order

func (*Store) LoadFromFile

func (x *Store) LoadFromFile(fileName string) (*v1.Entry, error)

func (*Store) LoadFromID

func (x *Store) LoadFromID(id v1.ID) (*v1.Entry, error)

func (*Store) LoadFromReader

func (x *Store) LoadFromReader(r io.Reader) (*v1.Entry, error)

func (*Store) Next

func (x *Store) Next(id v1.ID) (*v1.Entry, error)

func (*Store) Previous

func (x *Store) Previous(id v1.ID) (*v1.Entry, error)

func (*Store) Reconcile

func (x *Store) Reconcile(id v1.ID) (*v1.Entry, error)

func (*Store) ShouldReloadFromDisk

func (x *Store) ShouldReloadFromDisk(id v1.ID) bool

func (*Store) Status

func (x *Store) Status() v1.SyncStatus

func (*Store) StoragePath

func (x *Store) StoragePath(id v1.ID) string

func (*Store) Validate

func (x *Store) Validate() error

func (*Store) Write

func (x *Store) Write(e *v1.Entry) error

Jump to

Keyboard shortcuts

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