collection

package
v0.0.0-...-d277e4d Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package collection defines metadata helpers for bujo collections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDayName

func IsDayName(name string) bool

IsDayName reports whether value looks like "October 11, 2025".

func IsMonthName

func IsMonthName(name string) bool

IsMonthName reports whether value looks like "October 2025".

func MarshalList

func MarshalList(metas []Meta) ([]byte, error)

MarshalList serialises metadata slice.

func ValidateChildName

func ValidateChildName(parentType Type, parentName string, childName string) error

ValidateChildName checks if a child collection name is valid for the parent type.

func ValidateTypeTransition

func ValidateTypeTransition(current, next Type) error

ValidateTypeTransition ensures runtime changes obey rules. For now only forbids switching to unknown types.

Types

type Meta

type Meta struct {
	Name string `json:"name"`
	Type Type   `json:"type,omitempty"`
}

Meta describes persisted per-collection metadata.

func UnmarshalList

func UnmarshalList(data []byte) ([]Meta, error)

UnmarshalList deserialises metadata slice and upgrades legacy arrays of strings.

type Type

type Type string

Type identifies how a collection should behave in the UI.

const (
	// TypeGeneric is the default free-form collection.
	TypeGeneric Type = "generic"
	// TypeMonthly groups child month collections (e.g. Future log).
	TypeMonthly Type = "monthly"
	// TypeDaily groups day collections inside a month.
	TypeDaily Type = "daily"
	// TypeTracking is a numeric tracker collection.
	TypeTracking Type = "tracking"
)

func AllTypes

func AllTypes() []Type

AllTypes returns the list of supported collection types.

func GuessType

func GuessType(name string, parent Type) Type

GuessType inspects the collection name (and optionally parent) to infer a type.

func MustType

func MustType(raw string) Type

MustType parses the input and panics on error. Intended for tests/config.

func ParseType

func ParseType(raw string) (Type, error)

ParseType converts a string to a Type or returns an error for unknown values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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