documents

package
v0.0.0-...-ffc0cdd Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	Text     string    `json:"text"`
	Created  time.Time `json:"created"`
	Modified time.Time `json:"modified"`
	Meta     Meta      `json:"meta"`
}

Content represents the content portion of the Document.

type Coordinate

type Coordinate struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Altitude  float64 `json:"altitude"`
}

Coordinate represents a geographic coordinate on Earth.

type Document

type Document struct {
	Identifier string    `json:"identifier"`
	Content    Content   `json:"content"`
	History    []Content `json:"history"`
}

Document represents a complete database record.

func DecodeDocument

func DecodeDocument(in string) (*Document, error)

DecodeDocument returns a new document for a given JSON string.

func DecodeDocuments

func DecodeDocuments(in []string) ([]Document, error)

DecodeDocuments returns a list of documents.

func NewDocument

func NewDocument() Document

NewDocument returns a new empty document.

func (*Document) Serialize

func (d *Document) Serialize() string

Serialize returns a JSON string of the Document.

type Documents

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

Documents represents the interface for interacting with Documents.

func New

func New(name string) (*Documents, error)

New returns a database interface for interacting with Documents.

func (*Documents) DocumentDelete

func (d *Documents) DocumentDelete(id string) error

DocumentDelete removes a document from storage.

func (*Documents) DocumentForIdentifier

func (d *Documents) DocumentForIdentifier(id string) (*Document, error)

DocumentForIdentifier returns a document for a given identifier.

func (*Documents) DocumentSave

func (d *Documents) DocumentSave(id string, content Content) error

DocumentSave returns a created or updated document, maintaining a history of edits.

func (*Documents) Documents

func (d *Documents) Documents() ([]Document, error)

Documents returns all documents.

func (*Documents) DocumentsForContentType

func (d *Documents) DocumentsForContentType(contentType string) ([]Document, error)

DocumentsForContentType returns all documents for a given content-type.

func (*Documents) DocumentsForTag

func (d *Documents) DocumentsForTag(tag string) ([]Document, error)

DocumentsForTag returns all documents matching the given tag.

type Location

type Location struct {
	Name       string     `json:"name,omitempty"`
	Coordinate Coordinate `json:"coordinate"`
}

Location represents a location(s).

type Meta

type Meta struct {
	ContentType string    `json:"contentType"`
	Tags        []string  `json:"tags"`
	Color       int64     `json:"color"`
	Location    *Location `json:"location,omitempty"`
}

Meta represents the meta-data portion of the Content.

func NewMeta

func NewMeta(in string) (*Meta, error)

NewMeta returns new Meta for a given JSON string.

func (Meta) ToJSON

func (m Meta) ToJSON() string

ToJSON returns a JSON string.

Jump to

Keyboard shortcuts

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