store

package
v0.0.0-...-5cdab17 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package store contains common types.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is the error returned by the TiddlerStore when no tiddlers with a given key are found.

View Source
var MustOpen func(dataSource string) TiddlerStore

MustOpen is a function variable assigned by the TiddlerStore implementations. MustOpen must return a working TiddlerStore given a data source.

Functions

This section is empty.

Types

type Tiddler

type Tiddler struct {
	Key      string // The title of the tiddler
	Meta     []byte // Meta information (the tiddler serialized to JSON without text)
	Text     string // The text of the tiddler
	WithText bool   // If the tiddler is non-skinny (should be serialized with its text).
}

Tiddler is a fundamental piece of content in TiddlyWeb.

func (*Tiddler) MarshalJSON

func (t *Tiddler) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler If t is skinny (t.WithText is false), it returns t.Meta (not its copy).

type TiddlerStore

type TiddlerStore interface {
	// Get retrieves a tiddler from the store by key (title).
	// Get should return ErrNotFound error when no tiddlers with the given key are found.
	Get(ctx context.Context, key string) (Tiddler, error)

	// All retrieves all the tiddlers from the store.
	// Most tiddlers should be returned skinny, except for special tiddlers,
	// like global macros (tiddlers tagged $:/tags/Macro), which should be
	// returned fat.
	// All must not return deleted tiddlers.
	All(ctx context.Context) ([]Tiddler, error)

	// Put saves tiddler to the store and returns its revision.
	Put(ctx context.Context, tiddler Tiddler) (int, error)

	// Delete deletes a tiddler by key.
	Delete(ctx context.Context, key string) error
}

TiddlerStore provides an interface for retrieving, storing and deleting tiddlers.

Directories

Path Synopsis
Package bolt is a BoltDB TiddlerStore backend.
Package bolt is a BoltDB TiddlerStore backend.

Jump to

Keyboard shortcuts

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