pipetdata

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package pipetdata impliments meat of pipet, data access functions - which are being called out from CLI

Index

Constants

This section is empty.

Variables

View Source
var (
	// EBadData error bad data on disk
	EBadData = fmt.Errorf("bad data")
)

Functions

This section is empty.

Types

type DataStore

type DataStore struct {
	// contains filtered or unexported fields
}

DataStore is the main structure for snippet access

func NewDataStore

func NewDataStore(documentDir string) (*DataStore, error)

NewDataStore creates a new datastore abastraction for storing notes. disk path is passed as documentDir

func (*DataStore) Delete added in v0.0.2

func (d *DataStore) Delete(id string) error

func (*DataStore) Exist

func (d *DataStore) Exist(filename string) bool

Exist checks with a snippet with the name exists.

func (*DataStore) Fullpath

func (d *DataStore) Fullpath(id string) string

func (*DataStore) List

func (d *DataStore) List() (sns []*Snippet, err error)

func (*DataStore) New

func (d *DataStore) New(title string, tags ...string) (fn string, err error)

New creates a new entry in snippets

func (*DataStore) Read

func (d *DataStore) Read(id string) (sn *Snippet, err error)

Read reads and parses a snippet document

type Snippet

type Snippet struct {
	Meta metadata
	Data string
}

Snippet is the data type holding the actual snippet

func (*Snippet) Marshal

func (s *Snippet) Marshal() ([]byte, error)

Marshal serializes snippet data into bytes. Format is --- yaml metadata front --- <text follows> This is very similiar to pandoc markdown except its just arbitary text for now.

func (*Snippet) Unmarshal

func (s *Snippet) Unmarshal(buf []byte) error

Unmarshal takes in note data with metadata blocks in yaml and populates Snippet structure. https://jekyllrb.com/docs/frontmatter/

Jump to

Keyboard shortcuts

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