Documentation
¶
Index ¶
- func GetAppDataDir() (string, error)
- func GetDefaultDatabasePath() (string, error)
- type Config
- type Driver
- type SQLiteDriver
- func (d *SQLiteDriver) Close() error
- func (d *SQLiteDriver) DB() *sql.DB
- func (d *SQLiteDriver) GetAllConfig(ctx context.Context) (map[string]string, error)
- func (d *SQLiteDriver) GetConfig(ctx context.Context, key string) (string, error)
- func (d *SQLiteDriver) HasConfig(ctx context.Context) (bool, error)
- func (d *SQLiteDriver) Initialize(ctx context.Context) error
- func (d *SQLiteDriver) SetConfig(ctx context.Context, key, value string) error
- func (d *SQLiteDriver) Type() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAppDataDir ¶
GetAppDataDir returns the application data directory for macOS
func GetDefaultDatabasePath ¶
GetDefaultDatabasePath returns the default SQLite database path
Types ¶
type Config ¶
type Config struct {
// Type is the database type: "postgres" or "sqlite"
Type string
// For PostgreSQL
PostgresURL string
// For SQLite
SQLitePath string
}
Config holds database configuration
type Driver ¶
type Driver interface {
// DB returns the underlying *sql.DB connection
DB() *sql.DB
// Close closes the database connection
Close() error
// Initialize sets up the database schema if needed
Initialize(ctx context.Context) error
// Type returns the database type (e.g., "postgres", "sqlite")
Type() string
}
Driver represents a database driver that can be used by the application. This abstraction allows swapping between PostgreSQL and SQLite implementations.
type SQLiteDriver ¶
type SQLiteDriver struct {
// contains filtered or unexported fields
}
SQLiteDriver implements Driver for SQLite database
func NewSQLiteDriver ¶
func NewSQLiteDriver(dbPath string) (*SQLiteDriver, error)
NewSQLiteDriver creates a new SQLite database driver
func (*SQLiteDriver) Close ¶
func (d *SQLiteDriver) Close() error
Close closes the database connection
func (*SQLiteDriver) DB ¶
func (d *SQLiteDriver) DB() *sql.DB
DB returns the underlying *sql.DB connection
func (*SQLiteDriver) GetAllConfig ¶
GetAllConfig retrieves all configuration values as a map
func (*SQLiteDriver) HasConfig ¶
func (d *SQLiteDriver) HasConfig(ctx context.Context) (bool, error)
HasConfig checks if any config has been saved
func (*SQLiteDriver) Initialize ¶
func (d *SQLiteDriver) Initialize(ctx context.Context) error
Initialize sets up the database schema
Click to show internal directories.
Click to hide internal directories.