db

package
v0.0.0-...-f0049f5 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadClaudeMD

func LoadClaudeMD(dsn string) *gorm.DB

func LoadSearchIndex

func LoadSearchIndex(indexPath string) (bleve.Index, error)

func NewClaudeDB

func NewClaudeDB(dsn string) *gorm.DB

NewClaudeDB creates a new database connection for Claude operations

func WalkDirectory

func WalkDirectory(fsys fs.FS, dir string, processFunc ProcessFileFunc) error

Types

type ConfigManager

type ConfigManager[T any] struct {
	// contains filtered or unexported fields
}

ConfigManager provides a simple interface for configuration management

func NewConfigManager

func NewConfigManager[T any](configDir string) (*ConfigManager[T], error)

NewConfigManager creates a new configuration manager for type T

func (*ConfigManager[T]) GetConfig

func (cm *ConfigManager[T]) GetConfig(id string, defaultValue T) T

GetConfig retrieves configuration by ID, returns default value if not found

func (*ConfigManager[T]) SetConfig

func (cm *ConfigManager[T]) SetConfig(id string, config T) error

SetConfig stores configuration by ID

func (*ConfigManager[T]) UpdateConfig

func (cm *ConfigManager[T]) UpdateConfig(id string, defaultValue T, updateFn func(T) T) error

UpdateConfig applies a transformation function to the existing config

type DB

type DB[T any] struct {
	// contains filtered or unexported fields
}

func NewDB

func NewDB[T any](dir string) (*DB[T], error)

func (*DB[T]) Filter

func (s *DB[T]) Filter(query string) []T

Filter allows filtering the database using a gjson path

func (*DB[T]) Get

func (s *DB[T]) Get(id string) (T, bool)

func (*DB[T]) List

func (s *DB[T]) List() []T

func (*DB[T]) Set

func (s *DB[T]) Set(id string, v T) error

Set stores a value with the given id and saves it to a file

type PinnedDocsConfig

type PinnedDocsConfig struct {
	PinnedDocuments []string  `json:"pinnedDocuments"`
	Version         string    `json:"version"`
	LastUpdated     time.Time `json:"lastUpdated"`
}

PinnedDocsConfig represents the pinned documents configuration

func DefaultPinnedDocsConfig

func DefaultPinnedDocsConfig() PinnedDocsConfig

DefaultPinnedDocsConfig returns the default configuration for pinned documents

func (*PinnedDocsConfig) IsPinned

func (config *PinnedDocsConfig) IsPinned(docID string) bool

IsPinned checks if a document ID is in the pinned list

func (*PinnedDocsConfig) TogglePin

func (config *PinnedDocsConfig) TogglePin(docID string) bool

TogglePin adds or removes a document ID from the pinned list

type ProcessFileFunc

type ProcessFileFunc func(name string, contents []byte) error

type SearchIndex

type SearchIndex struct {
	Index bleve.Index
}

func NewSearchIndex

func NewSearchIndex(indexPath string) (*SearchIndex, error)

func (*SearchIndex) Batch

func (s *SearchIndex) Batch(b *bleve.Batch) error

func (*SearchIndex) DeleteDocument

func (s *SearchIndex) DeleteDocument(id string) error

func (*SearchIndex) IndexDocument

func (s *SearchIndex) IndexDocument(id string, data any) error

func (*SearchIndex) Search

func (s *SearchIndex) Search(query string) (*bleve.SearchResult, error)

Jump to

Keyboard shortcuts

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