package ersteller_lib import ( "context" "database/sql" _ "github.com/mattn/go-sqlite3" ) // CreateSQLiteConnpool creates a new SQLite connection pool func CreateSQLiteConnpool(dbPath string) (*sql.DB, error) { db, err := sql.Open("sqlite3", dbPath) if err != nil { Error("Error while creating connection to the SQLite database!!", err) return nil, err } // Test the connection err = db.PingContext(context.Background()) if err != nil { LogError("Could not ping SQLite database: %v", err) return nil, err } // Set connection pool settings db.SetMaxOpenConns(4) db.SetMaxIdleConns(2) return db, nil }