services

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachmentService

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

func NewAttachmentService

func NewAttachmentService(v *vault.Vault, repo ports.AssetRepository) *AttachmentService

func (*AttachmentService) Store

func (s *AttachmentService) Store(ctx context.Context, srcPath string, name string, description string) (string, bool, error)

Store saves a file and its metadata Returns: filename, isDuplicate, error

type BuildAllRequest

type BuildAllRequest struct {
	MaxWorkers int // Number of concurrent workers
}

BuildAllRequest represents a request to build all notes

type BuildAllResponse

type BuildAllResponse struct {
	Total     int
	Succeeded int
	Failed    int
	Results   []BuildResponse
}

BuildAllResponse represents the response from building all notes

type BuildProgress

type BuildProgress struct {
	Current int
	Total   int
	Slug    string
	Success bool
	Error   error
}

BuildProgress represents the progress of a build operation

type BuildRequest

type BuildRequest struct {
	Slug string
}

BuildRequest represents a request to build a note

type BuildResponse

type BuildResponse struct {
	Slug       string
	OutputPath string
	Success    bool
	Error      error
}

BuildResponse represents the response from building a note

type BuildResultDetails added in v0.1.4

type BuildResultDetails struct {
	Slug       string
	Success    bool
	Parsed     *latexparser.ParseResult
	Output     string
	OutputPath string
	Error      error
}

BuildResultDetails contains detailed compilation results including parsed output

type BuildService

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

BuildService handles LaTeX compilation operations

func NewBuildService

func NewBuildService(noteRepo ports.Repository, compiler ports.Compiler, v *vault.Vault) *BuildService

NewBuildService creates a new build service (Normal usage)

func NewBuildServiceWithPreprocessor added in v0.1.3

func NewBuildServiceWithPreprocessor(noteRepo ports.Repository, compiler ports.Compiler, preprocessor ports.Preprocessor, v *vault.Vault) *BuildService

NewBuildServiceWithPreprocessor creates a new build service with injected preprocessor (For testing)

func (*BuildService) Execute

func (s *BuildService) Execute(ctx context.Context, req BuildRequest) (*BuildResponse, error)

Execute builds a single note and returns basic response

func (*BuildService) ExecuteAll

func (s *BuildService) ExecuteAll(ctx context.Context, req BuildAllRequest) (*BuildAllResponse, error)

ExecuteAll builds all notes concurrently

func (*BuildService) ExecuteAllWithProgress

func (s *BuildService) ExecuteAllWithProgress(ctx context.Context, req BuildAllRequest, progressChan chan<- BuildProgress) (*BuildAllResponse, error)

ExecuteAllWithProgress builds all notes and reports progress

func (*BuildService) ExecuteWithDetails added in v0.1.4

func (s *BuildService) ExecuteWithDetails(ctx context.Context, req BuildRequest) (*BuildResultDetails, error)

ExecuteWithDetails builds a single note and returns detailed compilation results

type CreateNoteRequest

type CreateNoteRequest struct {
	Title        string
	Tags         []string
	TemplateName string
}

CreateNoteRequest represents a request to create a new note

type CreateNoteResponse

type CreateNoteResponse struct {
	Note     *domain.NoteBody
	FilePath string
}

CreateNoteResponse represents the response from creating a note

type CreateNoteService

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

CreateNoteService handles the creation of new notes

func NewCreateNoteService

func NewCreateNoteService(noteRepo ports.Repository, templateRepo ports.TemplateRepository) *CreateNoteService

NewCreateNoteService creates a new note creation service

func (*CreateNoteService) Execute

Execute creates a new note with the given parameters

type CreateTemplateRequest

type CreateTemplateRequest struct {
	Title   string
	Content string
}

type CreateTemplateResponse

type CreateTemplateResponse struct {
	Template *domain.TemplateBody
	FilePath string
}

type CreateTemplateService

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

func NewCreateTemplateService

func NewCreateTemplateService(templateRepo ports.TemplateRepository) *CreateTemplateService

func (*CreateTemplateService) Execute

Execute creates a new template with the given parameters

type GraphData

type GraphData struct {
	Nodes []GraphNode `json:"nodes"`
	Links []GraphLink `json:"links"`
}

Data Structures (Keep existing JSON contract)

type GraphLink struct {
	Source string `json:"source"`
	Target string `json:"target"`
	Value  int    `json:"value"`
}

type GraphNode

type GraphNode struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Group int    `json:"group"`
	Value int    `json:"val"`
}

type GraphService

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

func NewGraphService

func NewGraphService(indexer *IndexerService) *GraphService

func (*GraphService) GetGraph

func (s *GraphService) GetGraph(ctx context.Context, forceRefresh bool) (GraphData, error)

GetGraph retrieves the graph data from the Index

type GrepMatch

type GrepMatch struct {
	Slug     string
	Filename string
	LineNum  int
	Content  string
}

GrepMatch represents a single line match

type GrepService

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

GrepService handles full-text search operations

func NewGrepService

func NewGrepService(vaultRoot string) *GrepService

NewGrepService creates a new grep service

func (*GrepService) Execute

func (s *GrepService) Execute(ctx context.Context, query string) ([]GrepMatch, error)

Execute scans all notes and returns matches If query is empty, returns all non-empty lines (for fuzzy finding)

type IndexerService

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

func NewIndexerService

func NewIndexerService(noteRepo ports.Repository, indexPath string) *IndexerService

func (*IndexerService) Execute

func (*IndexerService) IndexExists

func (s *IndexerService) IndexExists() bool

func (*IndexerService) LoadIndex

func (s *IndexerService) LoadIndex() (*domain.Index, error)

type ListRequest

type ListRequest struct {
	TagFilter string // Filter by specific tag (optional)
	SortBy    string // "date", "title" (default: date)
	Reverse   bool   // Reverse sort order
}

ListRequest represents a request to list notes

type ListResponse

type ListResponse struct {
	Notes []domain.NoteHeader
	Total int
}

ListResponse represents the response from listing notes

type ListService

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

ListService handles listing and filtering notes

func NewListService

func NewListService(noteRepo ports.Repository) *ListService

NewListService creates a new list service

func (*ListService) Execute

func (s *ListService) Execute(ctx context.Context, req ListRequest) (*ListResponse, error)

Execute lists notes with optional filtering and sorting

func (*ListService) Search

func (s *ListService) Search(ctx context.Context, req SearchRequest) (*SearchResponse, error)

Search performs fuzzy search on notes

type Preprocessor added in v0.1.3

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

func NewPreprocessor added in v0.1.3

func NewPreprocessor(repo ports.Repository, v *vault.Vault) *Preprocessor

func (*Preprocessor) Process added in v0.1.3

func (p *Preprocessor) Process(slug string) (string, error)

Process creates a temporary compilable version of the note with resolved links Returns the absolute path to the preprocessed file in the cache

type ReindexRequest

type ReindexRequest struct{}

type ReindexResponse

type ReindexResponse struct {
	TotalNotes       int
	TotalConnections int
	Duration         string
}

type SearchRequest

type SearchRequest struct {
	Query string
}

SearchRequest represents a search query

type SearchResponse

type SearchResponse struct {
	Notes []domain.NoteHeader
	Total int
}

SearchResponse represents search results

Jump to

Keyboard shortcuts

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