Help us shape the future of Go! Take the 2026 Go Developer Survey

domain

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicateGroup = errors.New("duplicate group")

ErrDuplicateGroup indicates a repeated normalized group.

View Source
var ErrDuplicateTag = errors.New("duplicate tag")

ErrDuplicateTag indicates a repeated normalized tag.

View Source
var ErrInvalidArea = errors.New("invalid area")

ErrInvalidArea indicates an invalid page area.

View Source
var ErrInvalidBookmark = errors.New("invalid bookmark")

ErrInvalidBookmark indicates an invalid bookmark note.

View Source
var ErrInvalidDate = errors.New("invalid date")

ErrInvalidDate indicates an invalid calendar date.

View Source
var ErrInvalidGroup = errors.New("invalid group")

ErrInvalidGroup indicates an invalid group.

View Source
var ErrInvalidInbox = errors.New("invalid inbox")

ErrInvalidInbox indicates an invalid inbox note.

View Source
var ErrInvalidJournal = errors.New("invalid journal")

ErrInvalidJournal indicates an invalid journal note.

View Source
var ErrInvalidMetadata = errors.New("invalid note metadata")

ErrInvalidMetadata indicates invalid common note metadata.

View Source
var ErrInvalidNoteKind = errors.New("invalid note kind")

ErrInvalidNoteKind indicates an unsupported note kind.

View Source
var ErrInvalidPage = errors.New("invalid page")
View Source
var ErrInvalidPerson = errors.New("invalid person")
View Source
var ErrInvalidTag = errors.New("invalid tag")

ErrInvalidTag indicates an invalid tag.

View Source
var ErrInvalidTitle = errors.New("invalid title")

ErrInvalidTitle indicates an invalid note title.

View Source
var ErrInvalidURL = errors.New("invalid URL")

ErrInvalidURL indicates an invalid bookmark URL.

Functions

func Slugify

func Slugify(value string) string

Slugify applies the current slugging policy. It lowercases, strips diacritics and collapses separators into hyphens.

Types

type Area

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

Area represents a validated hierarchical location for pages.

func NewArea

func NewArea(value string) (Area, error)

NewArea creates an area from slash-separated segments.

func (Area) Equal

func (area Area) Equal(other Area) bool

Equal reports whether two areas contain the same segments.

func (Area) IsZero

func (area Area) IsZero() bool

IsZero reports whether the area is empty.

func (Area) Name

func (area Area) Name() string

Name returns the first area segment.

func (Area) String

func (area Area) String() string

String returns the normalized area path.

func (Area) Subarea

func (area Area) Subarea() (Area, bool)

Subarea returns the next nested area when one exists.

type Bookmark

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

Bookmark is a saved HTTP or HTTPS link.

func NewBookmark

func NewBookmark(noteID uuid.UUID, url URL, tags Tags, createdAt time.Time) (Bookmark, error)

NewBookmark creates a bookmark from validated values.

func (Bookmark) Metadata

func (bookmark Bookmark) Metadata() Metadata

Metadata returns the bookmark metadata.

func (Bookmark) URL

func (bookmark Bookmark) URL() URL

URL returns the bookmark URL.

type Date

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

Date represents a calendar date in YYYY-MM-DD format.

func DateFromTime

func DateFromTime(value time.Time) Date

DateFromTime creates a date from a time value.

func NewDate

func NewDate(value string) (Date, error)

NewDate creates a validated calendar date.

func (Date) IsZero

func (date Date) IsZero() bool

IsZero reports whether the date is uninitialized.

func (Date) String

func (date Date) String() string

String returns the date in YYYY-MM-DD format.

type Group

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

Group represents a normalized note group.

func NewGroup

func NewGroup(value string) (Group, error)

NewGroup creates a normalized group.

func (Group) Equal

func (group Group) Equal(other Group) bool

Equal reports whether two groups have the same normalized value.

func (Group) IsZero

func (group Group) IsZero() bool

IsZero reports whether the group is uninitialized.

func (Group) String

func (group Group) String() string

String returns the normalized group value.

type Groups

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

Groups is an immutable, ordered collection of unique note groups. Its zero value is a valid empty collection.

func NewGroups

func NewGroups(values ...Group) (Groups, error)

NewGroups creates an ordered collection of unique groups.

func (Groups) Contains

func (groups Groups) Contains(group Group) bool

Contains reports whether the collection contains group.

func (Groups) IsEmpty

func (groups Groups) IsEmpty() bool

IsEmpty reports whether the collection contains no groups.

func (Groups) Items

func (groups Groups) Items() []Group

Items returns a copy of the normalized group values.

func (Groups) Len

func (groups Groups) Len() int

Len returns the number of groups.

func (Groups) Strings

func (groups Groups) Strings() []string

Strings returns the normalized groups as strings in their original order.

type Inbox

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

Inbox is a quick note awaiting review.

func NewInbox

func NewInbox(noteID uuid.UUID, content string, createdAt time.Time) (Inbox, error)

NewInbox creates an inbox note. Content may be empty until the note is edited.

func (Inbox) Content

func (inbox Inbox) Content() string

Content returns the captured content.

func (Inbox) Metadata

func (inbox Inbox) Metadata() Metadata

Metadata returns the inbox metadata.

type Journal

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

Journal is a note associated with a calendar date.

func NewJournal

func NewJournal(noteID uuid.UUID, date Date, tags Tags, createdAt time.Time) (Journal, error)

NewJournal creates a journal from validated values.

func (Journal) Date

func (journal Journal) Date() Date

Date returns the journal date.

func (Journal) Metadata

func (journal Journal) Metadata() Metadata

Metadata returns the journal metadata.

type Metadata

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

Metadata contains the properties shared by every note.

func (Metadata) CreatedAt

func (metadata Metadata) CreatedAt() time.Time

CreatedAt returns the note creation time.

func (Metadata) ID

func (metadata Metadata) ID() uuid.UUID

ID returns the note identifier.

func (Metadata) Kind

func (metadata Metadata) Kind() NoteKind

Kind returns the note kind.

func (Metadata) Tags

func (metadata Metadata) Tags() Tags

Tags returns the note tags.

func (Metadata) UpdatedAt

func (metadata Metadata) UpdatedAt() time.Time

UpdatedAt returns the last note update time.

type Note

type Note interface {
	Metadata() Metadata
	// contains filtered or unexported methods
}

Note is a supported note that exposes its common metadata.

type NoteKind

type NoteKind string

NoteKind identifies a supported note type.

const (
	NoteKindPage     NoteKind = "page"
	NoteKindJournal  NoteKind = "journal"
	NoteKindInbox    NoteKind = "inbox"
	NoteKindBookmark NoteKind = "bookmark"
	NoteKindPerson   NoteKind = "person"
)

func ParseNoteKind

func ParseNoteKind(value string) (NoteKind, error)

ParseNoteKind parses a note kind.

func (NoteKind) IsValid

func (kind NoteKind) IsValid() bool

IsValid reports whether kind is supported.

func (NoteKind) String

func (kind NoteKind) String() string

String returns the serialized note kind.

type Page

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

Page is a titled note that may belong to an area.

func NewPage

func NewPage(noteID uuid.UUID, title Title, area Area, tags Tags, createdAt time.Time) (Page, error)

NewPage creates a page from validated values.

func (Page) Area

func (page Page) Area() Area

Area returns the page area. It may be zero when the page has no area.

func (Page) Metadata

func (page Page) Metadata() Metadata

Metadata returns the page metadata.

func (Page) Title

func (page Page) Title() Title

Title returns the page title.

type Person

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

Person is a note about someone the user knows.

func NewPerson

func NewPerson(noteID uuid.UUID, name Title, groups Groups, tags Tags, createdAt time.Time) (Person, error)

NewPerson creates a person from validated values.

func (Person) Groups

func (person Person) Groups() Groups

Groups returns the groups the person belongs to.

func (Person) Metadata

func (person Person) Metadata() Metadata

Metadata returns the person metadata.

func (Person) Name

func (person Person) Name() Title

Name returns the person's full name.

type Tag

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

Tag represents a normalized note tag.

func NewTag

func NewTag(value string) (Tag, error)

NewTag creates a normalized tag.

func (Tag) Equal

func (tag Tag) Equal(other Tag) bool

Equal reports whether two tags have the same normalized value.

func (Tag) IsZero

func (tag Tag) IsZero() bool

IsZero reports whether the tag is uninitialized.

func (Tag) String

func (tag Tag) String() string

String returns the normalized tag value.

type Tags

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

Tags is an immutable, ordered collection of unique note tags. Its zero value is a valid empty collection.

func NewTags

func NewTags(values ...Tag) (Tags, error)

NewTags creates an ordered collection of unique tags.

func (Tags) Contains

func (tags Tags) Contains(tag Tag) bool

Contains reports whether the collection contains tag.

func (Tags) IsEmpty

func (tags Tags) IsEmpty() bool

IsEmpty reports whether the collection contains no tags.

func (Tags) Items

func (tags Tags) Items() []Tag

Items returns a copy of the normalized tag values.

func (Tags) Len

func (tags Tags) Len() int

Len returns the number of tags.

func (Tags) Strings

func (tags Tags) Strings() []string

Strings returns the normalized tags as strings in their original order.

type Title

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

Title represents a validated, single-line note title.

func NewTitle

func NewTitle(value string) (Title, error)

NewTitle creates a title and its normalized slug.

func (Title) IsZero

func (title Title) IsZero() bool

IsZero reports whether the title is uninitialized.

func (Title) Slug

func (title Title) Slug() string

Slug returns the normalized title slug.

func (Title) String

func (title Title) String() string

String returns the title text.

type URL

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

URL represents a normalized HTTP or HTTPS URL.

func NewURL

func NewURL(value string) (URL, error)

NewURL creates a validated HTTP or HTTPS URL.

func (URL) IsZero

func (value URL) IsZero() bool

IsZero reports whether the URL is uninitialized.

func (URL) String

func (value URL) String() string

String returns the normalized URL.

Jump to

Keyboard shortcuts

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