Documentation
¶
Overview ¶
Package sqlite provides SQLite-based storage implementations for locdoc services.
Index ¶
- type DB
- func (db *DB) Close() error
- func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (db *DB) Open() error
- func (db *DB) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (db *DB) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
- func (db *DB) Stats() sql.DBStats
- type DocumentService
- func (s *DocumentService) CreateDocument(ctx context.Context, doc *locdoc.Document) error
- func (s *DocumentService) DeleteDocument(ctx context.Context, id string) error
- func (s *DocumentService) DeleteDocumentsByProject(ctx context.Context, projectID string) error
- func (s *DocumentService) FindDocumentByID(ctx context.Context, id string) (*locdoc.Document, error)
- func (s *DocumentService) FindDocuments(ctx context.Context, filter locdoc.DocumentFilter) ([]*locdoc.Document, error)
- type ProjectService
- func (s *ProjectService) CreateProject(ctx context.Context, project *locdoc.Project) error
- func (s *ProjectService) DeleteProject(ctx context.Context, id string) error
- func (s *ProjectService) FindProjectByID(ctx context.Context, id string) (*locdoc.Project, error)
- func (s *ProjectService) FindProjects(ctx context.Context, filter locdoc.ProjectFilter) ([]*locdoc.Project, error)
- func (s *ProjectService) UpdateProject(ctx context.Context, id string, upd locdoc.ProjectUpdate) (*locdoc.Project, error)
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 ¶
NewDB creates a new DB instance with the given path. Use ":memory:" for an in-memory database.
func (*DB) ExecContext ¶
ExecContext executes a statement that doesn't return rows.
func (*DB) QueryContext ¶
QueryContext executes a query that returns rows.
func (*DB) QueryRowContext ¶
QueryRowContext executes a query that returns a single row.
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 ¶
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 ¶
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 ¶
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.