Hasty Briefsbeta

Bilingual

Showh HN: SQLite JavaScript - extend your database with JavaScript

a year ago
  • #JavaScript
  • #Database
  • #SQLite
  • SQLite-JS extends SQLite with JavaScript capabilities, allowing custom functions, aggregates, window functions, and collation sequences.
  • Installation involves downloading pre-built binaries for various platforms (Linux, macOS, Windows, Android, iOS) and loading the extension.
  • Scalar functions process individual rows and return a single value, useful for data transformation and calculations.
  • Aggregate functions process multiple rows to return a single result, similar to standard SQL functions like SUM and AVG.
  • Window functions operate on sets of rows without collapsing them, enabling advanced data analysis.
  • Collation sequences define custom text comparison and sorting logic, supporting features like natural sorting.
  • Functions can be synchronized across devices using sqlite-sync, ensuring consistent behavior in distributed environments.
  • Direct JavaScript evaluation is possible within SQLite queries via the `js_eval` function.
  • Examples include creating functions for age calculation, median aggregation, and moving averages.
  • Updating functions requires a separate database connection due to SQLite constraints.
  • Building from source is supported with platform-specific Makefile instructions.
  • The project is licensed under the MIT License.