models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DateFormat = tools.DateFormat

Variables

View Source
var ErrorMissingDate = errors.New("Missing date")
View Source
var ErrorMissingTitle = errors.New("Missing title")
View Source
var ErrorParsing = errors.New("Parsing Error")

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Title  string
	Date   time.Time
	Fields Metas
}

func (Entry) MarshalJSON

func (e Entry) MarshalJSON() ([]byte, error)

func (Entry) MarshalText

func (e Entry) MarshalText() ([]byte, error)

func (*Entry) UnmarshalJSON

func (e *Entry) UnmarshalJSON(in []byte) error

func (*Entry) UnmarshalText

func (m *Entry) UnmarshalText(in []byte) error

type Log

type Log struct {
	Name    string
	Entries []Entry
}

func (*Log) UnmarshalText

func (l *Log) UnmarshalText(in []byte) error

type Meta

type Meta struct {
	Key   string
	Value any
}

func (Meta) MarshalText

func (m Meta) MarshalText() ([]byte, error)

func (*Meta) UnmarshalText

func (m *Meta) UnmarshalText(in []byte) error

type Metas added in v0.0.3

type Metas []Meta

A slice of Meta

func (Metas) Append added in v0.0.3

func (ms Metas) Append(k string, v any) Metas

Returns a new Metas with a new Meta appended

func (*Metas) AppendTo added in v0.0.3

func (ms *Metas) AppendTo(k string, v any)

Appends a new Meta to this Metas

func (Metas) Get added in v0.0.8

func (ms Metas) Get(key string) (any, bool)

Returns the value of the Meta with the given key, and a bool indicating if it was found

func (Metas) Map added in v0.0.3

func (ms Metas) Map() map[string]any

Returns a single map containing all the Meta. Is useful when encoding to JSON

func (Metas) MarshalJSON added in v0.0.3

func (ms Metas) MarshalJSON() ([]byte, error)

Implements json.Marshaler

func (Metas) Set added in v0.0.9

func (ms Metas) Set(key string, value any) Metas

Set sets the key to the given value. If key is already in the ms, Set updates the value of the found Meta. If key is not in ms, then we append a new Meta and return the modified Metas.

func (*Metas) UnmarshalJSON added in v0.0.3

func (ms *Metas) UnmarshalJSON(in []byte) error

Implements json.Unmarshaler

Jump to

Keyboard shortcuts

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