Add javascript function as a substitute to postgresql stored procedures / functions in postgresq
Offen
Dieses Issue hat noch niemand übernommen.
enhancement
- Vorherrschende Sprache
- JavaScript
- Sterne
- 13.7k
- Forks
- 1.1k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Add an ability for sql.js to apply custom javascript function in the SQL.
Would it be cool to see this in sql.js
CREATE TABLE people_location(
person_id int,
latitude double,
longitude double,
);
-- see people within 5 KM radius
SELECT * FROM people_location WHERE compute_distance(latitude, longitude, my_lat, my_long) <= 5;
function compute_distance(lat1, lon1, lat2, lon2){
var φ1 = lat1.toRadians(), φ2 = lat2.toRadians(), Δλ = (lon2-lon1).toRadians(), R = 6371; // gives d in km
var d = Math.acos( Math.sin(φ1)*Math.sin(φ2) + Math.cos(φ1)*Math.cos(φ2) * Math.cos(Δλ) ) * R;
return d;
}
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
The issue names no files, tests, or entry points. Start by locating how sql.js exposes SQLite functionality to JavaScript, then establish the intended registration and invocation behavior for custom SQL functions. Done means a JavaScript function can be registered, called from SQL, and covered by a focused test.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, sqlite
- Bereich
- database
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100