model

package
v0.0.0-...-9577d39 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorBadPostStructure is the error returned when trying to load a post with bad internal structure
	ErrorBadPostStructure = errors.New("bad post structure: must be post meta lines, separator, post body. Separator: " + postMetaDelimiter)
	// ErrorBadMetaStructure is the error returned when trying to load a post with bad meta structure
	ErrorBadMetaStructure = errors.New("bad post meta structure, must have the following lines: post title, publishing date, post tags")
)

Functions

This section is empty.

Types

type Meta

type Meta struct {
	Posts   int
	PerPage int
	Pages   int
}

Meta represents posts metadata model

func NewMeta

func NewMeta(posts, perPage int) *Meta

NewMeta instantiate posts metadata with pre-calculated fields

type Post

type Post struct {
	Path        string `storm:"id"`
	ID          string `storm:"unique"`
	Title       string
	PublishedAt time.Time `storm:"index"`
	Tags        []string
	Format      string

	Body       string
	BodyHTML   string
	Teaser     string
	TeaserHTML string
}

Post represents post model

func NewPostFromFile

func NewPostFromFile(basePath, postPath string, f formatter.Formatter) (*Post, error)

NewPostFromFile loads new post instance from file

type Tag

type Tag struct {
	Tag   string `storm:"id"`
	Paths []string
}

Tag represents post tag model

Jump to

Keyboard shortcuts

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