Using tagged template literals for queries, e.g.
db.query(sql`SELECT * FROM users WHERE id=${userID}`);
makes it virtually impossible for SQL Injection attacks to slip in un-noticed. All the @databases libraries enforce the use of the sql tagged template literals, so you can't accidentally miss them.
The query is then passed to your database engine as a separate string and values:
{text: 'SELECT * FROM users WHERE id=?', values: [userID]}
All the @databases APIs are designed with promises in mind from the get go.
Written in TypeScript, so every module has type safety and type definitions built in.
Each database driver is published to npm as a separate module, so you don't need to install the ones you don't need.
Package Name | Version | Docs |
---|---|---|
@databases/expo | https://www.atdatabases.org/docs/websql | |
@databases/mysql | https://www.atdatabases.org/docs/mysql | |
@databases/mysql-test | https://www.atdatabases.org/docs/mysql-test | |
@databases/pg | https://www.atdatabases.org/docs/pg | |
@databases/pg-migrations | https://www.atdatabases.org/docs/pg-migrations | |
@databases/pg-test | https://www.atdatabases.org/docs/pg-test | |
@databases/sql | https://www.atdatabases.org/docs/sql | |
@databases/sqlite | https://www.atdatabases.org/docs/sqlite | |
@databases/websql | https://www.atdatabases.org/docs/websql | |
@databases/escape-identifier | Not documented yet | |
@databases/migrations-base | Not documented yet | |
@databases/mysql-config | Not documented yet | |
@databases/pg-config | Not documented yet | |
@databases/pg-connection-string | Not documented yet | |
@databases/pg-create | Not documented yet | |
@databases/pg-data-type-id | Not documented yet | |
@databases/pg-errors | Not documented yet | |
@databases/pg-schema-cli | Not documented yet | |
@databases/pg-schema-introspect | Not documented yet | |
@databases/pg-schema-print-types | Not documented yet | |
@databases/pg-typed | Not documented yet | |
@databases/push-to-async-iterable | Not documented yet | |
@databases/split-sql-query | Not documented yet | |
@databases/validate-unicode | Not documented yet | |
@databases/websql-core | Not documented yet | |
@databases/with-container | Not documented yet |
Check out the website to learn more: https://www.atdatabases.org/