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

bookmark

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: 7 Imported by: 0

Documentation

Overview

Package bookmark creates, loads and updates saved HTTP and HTTPS links.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateCommand

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

CreateCommand supplies raw values for a new bookmark; optional collections may be empty.

type CreateHandler

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

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

func NewCreateHandler

func NewCreateHandler(repository ports.BookmarkRepository, 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 bookmark and its index projection.

type CreateResult

type CreateResult struct {
	Bookmark *bookmarks.Bookmark
}

CreateResult contains the bookmark returned after a successful create operation.

type GetHandler

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

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

func NewGetHandler

func NewGetHandler(repository ports.BookmarkRepository) *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 bookmark.

type GetQuery

type GetQuery struct {
	ID string
}

GetQuery identifies a bookmark by its stable UUID.

type GetResult

type GetResult struct {
	Bookmark *bookmarks.Bookmark
}

GetResult contains the bookmark returned after a successful get operation.

type UpdateCommand

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

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

type UpdateHandler

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

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

func NewUpdateHandler

func NewUpdateHandler(repository ports.BookmarkRepository) *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 bookmark, validates its replacement and persists the updated entity.

type UpdateResult

type UpdateResult struct {
	Bookmark *bookmarks.Bookmark
}

UpdateResult contains the bookmark returned after a successful update operation.

Jump to

Keyboard shortcuts

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