package database import ( "antrian-operasi/internal/config" "database/sql" "fmt" ) func (s *service) openSQLiteConnection(config config.DatabaseConfig) (*sql.DB, error) { // Open connection db, err := sql.Open("sqlite3", config.Path) if err != nil { return nil, fmt.Errorf("failed to open SQLite connection: %w", err) } // Enable foreign key constraints and WAL mode for better security and performance _, err = db.Exec("PRAGMA foreign_keys = ON; PRAGMA journal_mode = WAL;") if err != nil { return nil, fmt.Errorf("failed to configure SQLite: %w", err) } return db, nil }