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

journal

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Overview

Package journal manages dated entries whose date remains fixed during edits.

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = ports.ErrJournalAlreadyExists

ErrAlreadyExists identifies a journal date already present in the index.

Functions

This section is empty.

Types

type CreateCommand

type CreateCommand struct {
	Date    string
	Content string
	Tags    []string
}

CreateCommand accepts an optional YYYY-MM-DD date; empty means today.

type CreateHandler

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

CreateHandler validates input, assigns identity and lifecycle metadata, and saves a journal.

func NewCreateHandler

func NewCreateHandler(repository ports.JournalRepository, ids ports.IDGenerator) *CreateHandler

NewCreateHandler creates the use-case handler with its dependencies.

func (*CreateHandler) Handle

func (handler *CreateHandler) Handle(ctx context.Context, command CreateCommand) (CreateResult, error)

Handle validates raw input before persisting a new journal and its index projection.

type CreateResult

type CreateResult struct {
	Journal *journals.Journal
}

CreateResult contains the journal returned after a successful create operation.

type GetHandler

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

GetHandler loads a journal from its source document and verifies the requested identity.

func NewGetHandler

func NewGetHandler(repository ports.JournalRepository) *GetHandler

NewGetHandler creates the use-case handler with its dependencies.

func (*GetHandler) Handle

func (handler *GetHandler) Handle(ctx context.Context, query GetQuery) (GetResult, error)

Handle rejects invalid UUIDs and mismatched repository responses before returning a journal.

type GetQuery

type GetQuery struct {
	ID string
}

GetQuery identifies a journal by its stable UUID.

type GetResult

type GetResult struct {
	Journal *journals.Journal
}

GetResult contains the journal returned after a successful get operation.

type UpdateCommand

type UpdateCommand struct {
	ID      string
	Content string
	Tags    []string
}

UpdateCommand replaces the editable fields of an existing journal. Empty optional values clear their previous contents.

type UpdateHandler

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

UpdateHandler validates replacement values and retains the journal's identity and creation time.

func NewUpdateHandler

func NewUpdateHandler(repository ports.JournalRepository) *UpdateHandler

NewUpdateHandler creates the use-case handler with its dependencies.

func (*UpdateHandler) Handle

func (handler *UpdateHandler) Handle(ctx context.Context, command UpdateCommand) (UpdateResult, error)

Handle loads the existing journal, validates its replacement and persists the updated entity.

type UpdateResult

type UpdateResult struct {
	Journal *journals.Journal
}

UpdateResult contains the journal returned after a successful update operation.

Jump to

Keyboard shortcuts

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