zettel

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: EUPL-1.2 Imports: 8 Imported by: 0

Documentation

Overview

Package zettel provides specific types, constants, and functions for zettel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBinary

func IsBinary(data []byte) bool

IsBinary returns true if the given data appears to be non-text data.

Types

type Content

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

Content is just the content of a zettel.

func NewContent

func NewContent(data []byte) Content

NewContent creates a new content from a string.

func (*Content) AsBytes

func (zc *Content) AsBytes() []byte

AsBytes returns the content itself is a byte slice.

func (*Content) AsString

func (zc *Content) AsString() string

AsString returns the content itself is a string.

func (*Content) Encode

func (zc *Content) Encode() (data, encoding string)

Encode content for future transmission.

func (*Content) Equal

func (zc *Content) Equal(o *Content) bool

Equal compares two content values.

func (*Content) IsBinary

func (zc *Content) IsBinary() bool

IsBinary returns true if the content contains non-unicode values or is, interpreted a text, with a high probability binary content.

func (*Content) Length

func (zc *Content) Length() int

Length returns the number of bytes stored.

func (*Content) SetDecoded

func (zc *Content) SetDecoded(data, encoding string) error

SetDecoded content to the decoded value of the given string.

func (*Content) TrimSpace

func (zc *Content) TrimSpace()

TrimSpace remove some space character in content, if it is not binary content.

func (*Content) Write

func (zc *Content) Write(w io.Writer) (int, error)

Write it to a Writer

type Zettel

type Zettel struct {
	Meta    *meta.Meta // Some additional meta-data.
	Content Content    // The content of the zettel itself.
}

Zettel is the main data object of a zettelstore.

func (Zettel) Equal

func (z Zettel) Equal(o Zettel, allowComputed bool) bool

Equal compares two zettel for equality.

func (Zettel) Length

func (z Zettel) Length() int

Length returns the number of bytes to store the zettel (in a zettel view, not in a technical view).

Directories

Path Synopsis
Package id provides zettel specific types, constants, and functions about zettel identifier.
Package id provides zettel specific types, constants, and functions about zettel identifier.
Package meta provides the zettel specific type 'meta'.
Package meta provides the zettel specific type 'meta'.

Jump to

Keyboard shortcuts

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