sqlite

package
v0.0.0-...-1449a27 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package sqlite provides SQLite-based storage implementations for locdoc services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB represents a SQLite database connection.

func NewDB

func NewDB(path string) *DB

NewDB creates a new DB instance with the given path. Use ":memory:" for an in-memory database.

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection.

func (*DB) ExecContext

func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

ExecContext executes a statement that doesn't return rows.

func (*DB) Open

func (db *DB) Open() error

Open opens the database connection and creates the schema if needed.

func (*DB) QueryContext

func (db *DB) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

QueryContext executes a query that returns rows.

func (*DB) QueryRowContext

func (db *DB) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row

QueryRowContext executes a query that returns a single row.

func (*DB) Stats

func (db *DB) Stats() sql.DBStats

Stats returns database statistics.

type DocumentService

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

DocumentService implements locdoc.DocumentService using SQLite.

func NewDocumentService

func NewDocumentService(db *DB) *DocumentService

NewDocumentService creates a new DocumentService.

func (*DocumentService) CreateDocument

func (s *DocumentService) CreateDocument(ctx context.Context, doc *locdoc.Document) error

CreateDocument creates a new document.

func (*DocumentService) DeleteDocument

func (s *DocumentService) DeleteDocument(ctx context.Context, id string) error

DeleteDocument permanently removes a document.

func (*DocumentService) DeleteDocumentsByProject

func (s *DocumentService) DeleteDocumentsByProject(ctx context.Context, projectID string) error

DeleteDocumentsByProject removes all documents for a project.

func (*DocumentService) FindDocumentByID

func (s *DocumentService) FindDocumentByID(ctx context.Context, id string) (*locdoc.Document, error)

FindDocumentByID retrieves a document by ID.

func (*DocumentService) FindDocuments

func (s *DocumentService) FindDocuments(ctx context.Context, filter locdoc.DocumentFilter) ([]*locdoc.Document, error)

FindDocuments retrieves documents matching the filter.

type ProjectService

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

ProjectService implements locdoc.ProjectService using SQLite.

func NewProjectService

func NewProjectService(db *DB) *ProjectService

NewProjectService creates a new ProjectService.

func (*ProjectService) CreateProject

func (s *ProjectService) CreateProject(ctx context.Context, project *locdoc.Project) error

CreateProject creates a new project.

func (*ProjectService) DeleteProject

func (s *ProjectService) DeleteProject(ctx context.Context, id string) error

DeleteProject permanently removes a project.

func (*ProjectService) FindProjectByID

func (s *ProjectService) FindProjectByID(ctx context.Context, id string) (*locdoc.Project, error)

FindProjectByID retrieves a project by ID.

func (*ProjectService) FindProjects

func (s *ProjectService) FindProjects(ctx context.Context, filter locdoc.ProjectFilter) ([]*locdoc.Project, error)

FindProjects retrieves projects matching the filter.

func (*ProjectService) UpdateProject

func (s *ProjectService) UpdateProject(ctx context.Context, id string, upd locdoc.ProjectUpdate) (*locdoc.Project, error)

UpdateProject updates an existing project.

Jump to

Keyboard shortcuts

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