storage

package
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupTempDatabase

func CleanupTempDatabase() error

CleanupTempDatabase removes the temporary database file if it exists

func GetEmbeddedDatabasePath

func GetEmbeddedDatabasePath() (string, error)

GetEmbeddedDatabasePath returns a path to the embedded database file. It extracts the embedded database to a temporary location if needed.

func HasEmbeddedDatabase

func HasEmbeddedDatabase() bool

HasEmbeddedDatabase checks if an embedded database is available

Types

type Query

type Query struct {
	Language     string
	Type         string
	Category     string
	Status       string
	SupportLevel string
	Name         string
	Version      string
	MinDate      time.Time
	MaxDate      time.Time
	Tags         []string
	Maintainers  []string
	Framework    string // For instrumentation targets
	// Pagination support
	Limit  int // Maximum number of results to return (0 = no limit)
	Offset int // Number of results to skip
}

Query represents a query against the knowledge base

type QueryResult

type QueryResult struct {
	Components []types.Component
	Total      int // Total number of matching components (ignoring pagination)
	Returned   int // Number of components returned in this result
	Query      Query
	HasMore    bool // Whether there are more results available
}

QueryResult represents the result of a query

type Storage

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

Storage represents the knowledge base storage interface using SQLite

func NewStorage

func NewStorage(dbPath string, logger logger.Logger) (*Storage, error)

NewStorageWithLogger creates a new storage instance with a custom logger

func NewStorageWithEmbedded

func NewStorageWithEmbedded(dbPath string, logger logger.Logger) (*Storage, error)

NewStorageWithEmbedded creates a new storage instance using the embedded database as a fallback if no database path is provided or if the specified path doesn't exist.

func (*Storage) Close

func (s *Storage) Close() error

Close closes the database connection

func (*Storage) GetBreakingChanges

func (s *Storage) GetBreakingChanges(componentName string) []types.BreakingChange

GetBreakingChanges returns breaking changes for a given component

func (*Storage) GetCompatibleVersions

func (s *Storage) GetCompatibleVersions(componentName, version string) []types.CompatibleComponent

GetCompatibleVersions returns compatible versions for a given component and version

func (*Storage) GetComponentByName

func (s *Storage) GetComponentByName(name string) *types.Component

GetComponentByName returns a component by name

func (*Storage) GetComponentCount

func (s *Storage) GetComponentCount() (int, error)

GetComponentCount returns the total number of components in the database

func (*Storage) GetComponentsByCategory

func (s *Storage) GetComponentsByCategory(category types.ComponentCategory) []types.Component

GetComponentsByCategory returns all components of a specific category

func (*Storage) GetComponentsByLanguage

func (s *Storage) GetComponentsByLanguage(language types.ComponentLanguage) []types.Component

GetComponentsByLanguage returns all components for a specific language

func (*Storage) GetComponentsByStatus

func (s *Storage) GetComponentsByStatus(status types.ComponentStatus) []types.Component

GetComponentsByStatus returns all components with a specific status

func (*Storage) GetComponentsBySupportLevel

func (s *Storage) GetComponentsBySupportLevel(supportLevel types.SupportLevel) []types.Component

GetComponentsBySupportLevel returns all components with a specific support level

func (*Storage) GetComponentsByType

func (s *Storage) GetComponentsByType(componentType types.ComponentType) []types.Component

GetComponentsByType returns all components of a specific type

func (*Storage) GetComponentsLight

func (s *Storage) GetComponentsLight(query Query) *QueryResult

GetComponentsLight returns components without loading their versions (for performance)

func (*Storage) GetInstrumentationsByFramework

func (s *Storage) GetInstrumentationsByFramework(framework string) []types.Component

GetInstrumentationsByFramework returns all instrumentations for a specific framework

func (*Storage) GetLatestVersions

func (s *Storage) GetLatestVersions() map[string]types.Version

GetLatestVersions returns the latest version of each component

func (*Storage) GetVersionCount

func (s *Storage) GetVersionCount() (int, error)

GetVersionCount returns the total number of versions in the database

func (*Storage) LoadComponentVersions

func (s *Storage) LoadComponentVersions(componentName string) ([]types.Version, error)

LoadComponentVersions loads versions for a specific component by name

func (*Storage) QueryKnowledgeBase

func (s *Storage) QueryKnowledgeBase(query Query) *QueryResult

QueryKnowledgeBase queries the knowledge base based on criteria using SQLite with pagination support

func (*Storage) SaveComponents

func (s *Storage) SaveComponents(components []types.Component, filename string) error

func (*Storage) SaveKnowledgeBase

func (s *Storage) SaveKnowledgeBase(components []types.Component, filename string) error

SaveKnowledgeBase saves the knowledge base to the SQLite database using parallel processing

Jump to

Keyboard shortcuts

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