Documentation
¶
Index ¶
- type Config
- type Service
- func (s *Service) Close() error
- func (s *Service) EntityExists(entityID string) (bool, error)
- func (s *Service) GetDB() *sql.DB
- func (s *Service) GetSchemaVersion() (string, error)
- func (s *Service) GetStats() sql.DBStats
- func (s *Service) Health() error
- func (s *Service) HealthCheck() error
- func (s *Service) InitializeSchema() error
- func (s *Service) MigrateSchema() error
- func (s *Service) Name() string
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) Stop(ctx context.Context) error
- func (s *Service) Transaction(fn func(*sql.Tx) error) error
- func (s *Service) VerifySchema() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DBPath string
MaxOpenConns int
MaxIdleConns int
AutoInitialize bool // Automatically initialize schema if DB doesn't exist
}
Config holds database configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns default database configuration
type Service ¶
Service represents the database service with connection management
func NewService ¶
NewService creates a new database service with default configuration
func (*Service) EntityExists ¶
EntityExists checks if an entity exists in the database
func (*Service) GetSchemaVersion ¶
GetSchemaVersion returns the current schema version This is a placeholder for future versioning support
func (*Service) HealthCheck ¶
HealthCheck returns the health status of the database service (implements Service interface)
func (*Service) InitializeSchema ¶
InitializeSchema loads and executes the schema.sql file
func (*Service) MigrateSchema ¶
MigrateSchema applies any pending schema migrations This is a placeholder for future migration support
func (*Service) Stop ¶
Stop gracefully shuts down the database service (implements Service interface)
func (*Service) Transaction ¶
Transaction executes a function within a database transaction
func (*Service) VerifySchema ¶
VerifySchema checks if the database schema is properly initialized