tir

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package tir provides the interface-facing CRUD service.

Index

Constants

View Source
const (
	// IDLength for hexadecimal text IDs.
	IDLength = 2 * 2 * 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	io.Closer
	// Create a new text. This function is responsible for assigning
	// [text.Text.ID] and [text.Text.Timestamp].
	Create(new *text.Text) (*text.Text, error)
	// Read a text by its ID.
	Read(id string) (*text.Text, error)
	// Update a text with ID to include updates. Zero-valued fields in updates
	// (e.g. empty-string fields) are ignored.
	Update(id string, updates *text.Text) (*text.Text, error)
	// Delete a text by its ID.
	Delete(id string) (*text.Text, error)
	// List all texts sorted by decreasing [text.Text.Timestamp].
	List() ([]*text.Text, error)
}

Interface for managing tir texts. Callers should use this in lieu of store.Store; the latter assumes application-level validation implemented in this package. See New.

func New

func New(s store.Interface) Interface

New constructs a new application Interface around s. In general, use github.com/lukasschwab/tiir/pkg/config.Load instead to respect user configuration.

Jump to

Keyboard shortcuts

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