notes

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetentionHours         = 72
	DefaultStyleVersion    = "note/v1"
	DefaultPreviewMaxRunes = 120
)

Variables

View Source
var (
	ErrTopicNotFound    = errors.New("topic not found")
	ErrNoteNotFound     = errors.New("note not found")
	ErrInvalidTopicName = errors.New("invalid topic name")
	ErrInvalidNoteTitle = errors.New("invalid note title")
	ErrInvalidNoteBody  = errors.New("invalid note body")
	ErrInvalidColor     = errors.New("invalid note color")
	ErrInvalidNoteID    = errors.New("invalid note id")
	ErrInvalidTopicID   = errors.New("invalid topic id")
)

Functions

This section is empty.

Types

type CreateItemRequest

type CreateItemRequest struct {
	TopicID    string  `json:"topic_id"`
	Headline   *string `json:"headline,omitempty"`
	Title      *string `json:"title,omitempty"`
	Body       string  `json:"body"`
	ColorToken *string `json:"color_token,omitempty"`
	X          float64 `json:"x"`
	Y          float64 `json:"y"`
}

type CreateTopicRequest

type CreateTopicRequest struct {
	Name string `json:"name"`
}

type Event

type Event struct {
	Seq             int64           `json:"seq"`
	Type            string          `json:"type"`
	EntityKind      string          `json:"entity_kind"`
	EntityID        string          `json:"entity_id"`
	TopicID         string          `json:"topic_id,omitempty"`
	CreatedAtUnixMs int64           `json:"created_at_unix_ms"`
	Payload         json.RawMessage `json:"payload"`
}

type Item

type Item struct {
	NoteID          string  `json:"note_id"`
	TopicID         string  `json:"topic_id"`
	Title           string  `json:"title"`
	Headline        string  `json:"headline,omitempty"`
	Body            string  `json:"body"`
	PreviewText     string  `json:"preview_text"`
	CharacterCount  int     `json:"character_count"`
	SizeBucket      int     `json:"size_bucket"`
	StyleVersion    string  `json:"style_version"`
	ColorToken      string  `json:"color_token"`
	X               float64 `json:"x"`
	Y               float64 `json:"y"`
	ZIndex          int     `json:"z_index"`
	CreatedAtUnixMs int64   `json:"created_at_unix_ms"`
	UpdatedAtUnixMs int64   `json:"updated_at_unix_ms"`
}

type Service

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

func Open

func Open(path string) (*Service, error)

func (*Service) BringItemToFront

func (s *Service) BringItemToFront(ctx context.Context, noteID string) (Item, error)

func (*Service) ClearTrashTopic

func (s *Service) ClearTrashTopic(ctx context.Context, topicID string) error

func (*Service) Close

func (s *Service) Close() error

func (*Service) CreateItem

func (s *Service) CreateItem(ctx context.Context, req CreateItemRequest) (Item, error)

func (*Service) CreateTopic

func (s *Service) CreateTopic(ctx context.Context, req CreateTopicRequest) (Topic, error)

func (*Service) DeleteItem

func (s *Service) DeleteItem(ctx context.Context, noteID string) error

func (*Service) DeleteTopic

func (s *Service) DeleteTopic(ctx context.Context, topicID string) error

func (*Service) DeleteTrashedItemPermanently

func (s *Service) DeleteTrashedItemPermanently(ctx context.Context, noteID string) error

func (*Service) RestoreItem

func (s *Service) RestoreItem(ctx context.Context, noteID string) (Item, error)

func (*Service) Snapshot

func (s *Service) Snapshot(ctx context.Context) (Snapshot, error)

func (*Service) Subscribe

func (s *Service) Subscribe(ctx context.Context, afterSeq int64) ([]Event, <-chan Event, error)

func (*Service) UpdateItem

func (s *Service) UpdateItem(ctx context.Context, req UpdateItemRequest) (Item, error)

func (*Service) UpdateTopic

func (s *Service) UpdateTopic(ctx context.Context, req UpdateTopicRequest) (Topic, error)

type Snapshot

type Snapshot struct {
	Seq            int64       `json:"seq"`
	RetentionHours int         `json:"retention_hours"`
	Topics         []Topic     `json:"topics"`
	Items          []Item      `json:"items"`
	TrashItems     []TrashItem `json:"trash_items"`
}

type Store

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

type Topic

type Topic struct {
	TopicID         string `json:"topic_id"`
	Name            string `json:"name"`
	IconKey         string `json:"icon_key"`
	IconAccent      string `json:"icon_accent"`
	SortOrder       int    `json:"sort_order"`
	CreatedAtUnixMs int64  `json:"created_at_unix_ms"`
	UpdatedAtUnixMs int64  `json:"updated_at_unix_ms"`
	DeletedAtUnixMs int64  `json:"deleted_at_unix_ms"`
}

type TrashItem

type TrashItem struct {
	Item
	TopicName       string `json:"topic_name"`
	TopicIconKey    string `json:"topic_icon_key"`
	TopicIconAccent string `json:"topic_icon_accent"`
	TopicSortOrder  int    `json:"topic_sort_order"`
	DeletedAtUnixMs int64  `json:"deleted_at_unix_ms"`
}

type UpdateItemRequest

type UpdateItemRequest struct {
	NoteID     string   `json:"-"`
	Headline   *string  `json:"headline,omitempty"`
	Title      *string  `json:"title,omitempty"`
	Body       *string  `json:"body,omitempty"`
	ColorToken *string  `json:"color_token,omitempty"`
	X          *float64 `json:"x,omitempty"`
	Y          *float64 `json:"y,omitempty"`
}

type UpdateTopicRequest

type UpdateTopicRequest struct {
	TopicID string  `json:"-"`
	Name    *string `json:"name,omitempty"`
}

Jump to

Keyboard shortcuts

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