GlueSQL
SQL Database Engine as a Library
GlueSQL is a SQL database library written in Rust.
It provides a parser (sqlparser-rs), execution layer, and optional storages (sled
or memory
) packaged into a single library.
Developers can choose to use GlueSQL to build their own SQL database, or as an embedded SQL database using the default storage engine.
Standalone Mode
You can use GlueSQL as an embedded SQL database.
GlueSQL provides three reference storage options.
SledStorage
- Persistent storage engine based onsled
MemoryStorage
- Non-persistent storage engine based onBTreeMap
SharedMemoryStorage
- Non-persistent storage engine which works in multi-threaded environment
Installation
Cargo.toml
[]
= "0.13"
- CLI application
$ cargo install gluesql
Usage
use *;
SQL Library Mode (For Custom Storage)
Installation
sled-storage
and memory-storage
features are optional, so these are not required for custom storage makers.
[]
= "0.13"
= false
= ["alter-table", "index", "transaction"]
Four features below are also optional
alter-table
- ALTER TABLE query supportindex
- CREATE INDEX and DROP INDEX, index supporttransaction
- BEGIN, ROLLBACK and COMMIT, transaction support
Usage
Two mandatory store traits to implement
Optional store traits
GlueSQL.js
GlueSQL.js is a SQL database for web browsers and Node.js. It works as an embedded database and entirely runs in the browser. GlueSQL.js supports in-memory storage backend, but it will soon to have localStorage, sessionStorage and indexedDB backend supports.
More info
SQL Features
GlueSQL currently supports a limited subset of queries. It's being actively developed.
Data Types
Category | Type |
---|---|
Numeric | INT8 , INT16 , INT32 , INTEGER , INT128 , UINT8 , FLOAT , DECIMAL |
Date | DATE , TIME , TIMESTAMP , INTERVAL |
Others | BOOLEAN , TEXT , UUID , MAP , LIST , BYTEA |
Queries
CREATE TABLE
,DROP TABLE
ALTER TABLE
-ADD COLUMN
,DROP COLUMN
,RENAME COLUMN
andRENAME TO
.CREATE INDEX
,DROP INDEX
INSERT
,UPDATE
,DELETE
,SELECT
GROUP BY
,HAVING
ORDER BY
- Transaction queries:
BEGIN
,ROLLBACK
andCOMMIT
- Nested select, join, aggregations ...
You can see tests for the currently supported queries in test-suite/src/*.