sql-js / sql.js

A javascript library to run SQLite on the web.
http://sql.js.org
Other
12.55k stars 1.05k forks source link

Introducing a standard interface for database drivers #593

Open halvardssm opened 3 weeks ago

halvardssm commented 3 weeks ago

In the JS ecosystem for database drivers, this package is one of the more widely used. Together with the Deno Standard Library team, we have been working on creating a standard interface for JS that database drivers can adopt to provide consistency in how to interact with sql based databases, similar to what exists for the Go ecosystem.

In the JS community, we are quite wary of any breaking changes, or alterations of existing signatures, which is why this would not require a rewrite of existing code, but can live alongside the existing implementations. If the interface is adopted into the project, it is possible and also encouraged to provide both the existing exports alongside the new exports to allow for gradual adoption.

I am opening this issue to introduce the project, and to hopefully spark interest from the maintainer team to engage, contribute and potentially adopt the interfaces into this package. The current implementation of the standard interface is more or less stable, but if any overlooked issues or concerns surface, the implementation is open for amendments. I am also happy to provide implementation support if it helps adoption.

If this project is of interest to you, feel free to read the full specifications in the RFC PR, and comment here or in the RFC. And feel free to reach out if a further discussion is wanted.

Issues has been created for other popular db driver packages, and existing implementations can be found for the following drivers:

lovasoa commented 3 weeks ago

This is a great idea! Would you be interested in implementing and maintaining this interface in sql.js ?

halvardssm commented 3 weeks ago

Thanks @lovasoa ! As my focus is on creating and maintaining the standard interface, I don't think I can take the load to maintain the individual implementations, but I am happy to assist and give feedback around the implementation.

Are there any immediate challenges you see with implementing the interfaces? You can see an example for an sqlite implementation here