Documentation
¶
Overview ¶
Package ports defines the document, indexing and codec contracts used by the migrated notes.
Index ¶
- Variables
- type BookmarkEncoder
- type BookmarkRepository
- type HabitCodec
- type HabitRepository
- type IDGenerator
- type InboxEncoder
- type InboxRepository
- type Index
- type IndexRebuilder
- type JournalEncoder
- type JournalRepository
- type Note
- type NoteFilter
- type NoteFinder
- type NoteIndexDeleter
- type NoteKind
- type NoteProjector
- type NoteScanner
- type NoteStore
- type NoteSummary
- type PageEncoder
- type PageRepository
- type PersonCodec
- type PersonRepository
Constants ¶
This section is empty.
Variables ¶
var ErrHabitNotFound = errors.New("habit not found")
var ErrJournalAlreadyExists = errors.New("journal already exists")
var ErrNoteNotFound = errors.New("note not found")
var ErrPersonNotFound = errors.New("person not found")
Functions ¶
This section is empty.
Types ¶
type BookmarkEncoder ¶ added in v0.3.0
type BookmarkRepository ¶ added in v0.3.0
type HabitCodec ¶ added in v0.3.0
type HabitCodec interface {
Encode(*habits.Habit) ([]byte, error)
Decode([]byte) (*habits.Habit, error)
}
HabitCodec translates between a habit and its persisted document.
type HabitRepository ¶ added in v0.3.0
type HabitRepository interface {
Save(context.Context, *habits.Habit) error
ByID(context.Context, uuid.UUID) (*habits.Habit, error)
}
HabitRepository stores habit definitions.
type IDGenerator ¶
IDGenerator generates entity identifiers.
type InboxEncoder ¶ added in v0.3.0
type InboxRepository ¶ added in v0.3.0
type Index ¶ added in v0.3.0
type Index interface {
UpsertPage(context.Context, *pages.Page, string) error
UpsertJournal(context.Context, *journals.Journal, string) error
JournalExists(context.Context, calendar.Date) (bool, error)
UpsertBookmark(context.Context, *bookmarks.Bookmark, string) error
UpsertInbox(context.Context, *inbox.Inbox, string) error
UpsertHabit(context.Context, *habits.Habit, string) error
UpsertPerson(context.Context, *persons.Person, string) error
}
Index maintains searchable projections; documents remain the source of truth.
type IndexRebuilder ¶ added in v0.3.0
IndexRebuilder replaces all projections atomically. The supplied index is scoped to populate; it must not be retained after the callback returns.
type JournalEncoder ¶ added in v0.3.0
type JournalRepository ¶ added in v0.3.0
type Note ¶ added in v0.3.0
Note is a stored document; its content format is determined by its codec.
type NoteFilter ¶ added in v0.3.0
NoteFilter selects indexed notes. Empty type and tag match all notes.
type NoteFinder ¶ added in v0.3.0
type NoteFinder interface {
FindNotes(context.Context, NoteFilter) ([]NoteSummary, error)
}
NoteFinder reads summaries without loading or decoding note documents.
type NoteIndexDeleter ¶ added in v0.3.0
NoteIndexDeleter removes a note projection and its associated rows. Deleting an absent note is successful.
type NoteKind ¶ added in v0.3.0
type NoteKind string
NoteKind identifies the persisted document format, not an entity property.
type NoteProjector ¶ added in v0.3.0
NoteProjector decodes a document and writes its validated projection.
type NoteScanner ¶ added in v0.3.0
NoteScanner visits documents independently of the current index.
type NoteStore ¶ added in v0.3.0
type NoteStore interface {
Put(context.Context, Note) (string, error)
Get(context.Context, uuid.UUID) (Note, error)
Delete(context.Context, uuid.UUID) error
}
NoteStore persists documents independently of their domain model or format. Put returns the actual stored path; Get includes that path in the note.
type NoteSummary ¶ added in v0.3.0
NoteSummary is a read projection, independent of the note's domain entity.