All Projects β†’ gluesql β†’ Gluesql

gluesql / Gluesql

Licence: apache-2.0
GlueSQL is quite sticky, it attaches to anywhere.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Gluesql

Ring
Innovative and practical general-purpose multi-paradigm language
Stars: ✭ 716 (+54.64%)
Mutual labels:  webassembly, functional-programming
Grain
The Grain compiler toolchain and CLI. Home of the modern web staple. 🌾
Stars: ✭ 2,199 (+374.95%)
Mutual labels:  webassembly, functional-programming
Programming
Code a program in a language of your choice.
Stars: ✭ 269 (-41.9%)
Mutual labels:  sql, functional-programming
Airframe
Essential Building Blocks for Scala
Stars: ✭ 442 (-4.54%)
Mutual labels:  sql
Buji Pac4j
pac4j security library for Shiro: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 444 (-4.1%)
Mutual labels:  sql
Interface Types
Stars: ✭ 448 (-3.24%)
Mutual labels:  webassembly
Partiql Lang Kotlin
A implementation of PartiQL written in Kotlin.
Stars: ✭ 459 (-0.86%)
Mutual labels:  sql
Android Orma
An ORM for Android with type-safety and painless smart migrations
Stars: ✭ 442 (-4.54%)
Mutual labels:  sql
Toucan
A classy high-level Clojure library for defining application models and retrieving them from a DB
Stars: ✭ 456 (-1.51%)
Mutual labels:  sql
Cockroach
CockroachDB - the open source, cloud-native distributed SQL database.
Stars: ✭ 22,700 (+4802.81%)
Mutual labels:  sql
Arrow
Ξ›rrow - Functional companion to Kotlin's Standard Library
Stars: ✭ 4,771 (+930.45%)
Mutual labels:  functional-programming
Koazee
A StreamLike, Immutable, Lazy Loading and smart Golang Library to deal with slices.
Stars: ✭ 446 (-3.67%)
Mutual labels:  functional-programming
Presto Ethereum
Presto Ethereum Connector -- SQL on Ethereum
Stars: ✭ 450 (-2.81%)
Mutual labels:  sql
Wasmwinforms
C# Winforms for Webassembly
Stars: ✭ 444 (-4.1%)
Mutual labels:  webassembly
Vavr
vʌvr (formerly called Javaslang) is a non-commercial, non-profit object-functional library that runs with Java 8+. It aims to reduce the lines of code and increase code quality.
Stars: ✭ 4,616 (+896.98%)
Mutual labels:  functional-programming
Wasm Imagemagick
Webassembly compilation of https://github.com/ImageMagick/ImageMagick & samples
Stars: ✭ 442 (-4.54%)
Mutual labels:  webassembly
Beam
A type-safe, non-TH Haskell SQL library and ORM
Stars: ✭ 454 (-1.94%)
Mutual labels:  sql
Graphql Compiler
Turn complex GraphQL queries into optimized database queries.
Stars: ✭ 447 (-3.46%)
Mutual labels:  sql
Go Mysql Server
A MySQL-compatible relational database with a storage agnostic query engine. Implemented in pure Go.
Stars: ✭ 445 (-3.89%)
Mutual labels:  sql
Mostly Adequate Guide
Mostly adequate guide to FP (in javascript)
Stars: ✭ 21,330 (+4506.91%)
Mutual labels:  functional-programming

GlueSQL

crates.io docs.rs LICENSE Rust Chat

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 storage (sled) 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 sled as a default storage engine.

Installation

In your Cargo.toml:

[dependencies]
gluesql = "0.4"

Usage

use gluesql::{parse, Glue, SledStorage};

fn main() {
    let storage = SledStorage::new("data.db").unwrap();
    let mut glue = Glue::new(storage);

    let sqls = "
        CREATE TABLE Glue (id INTEGER);
        INSERT INTO Glue VALUES (100);
        INSERT INTO Glue VALUES (200);
        SELECT * FROM Glue WHERE id > 100;
        DROP TABLE Glue;
    ";
    
    for query in parse(sqls).unwrap() {
        glue.execute(&query).unwrap();
    }
}

SQL Library Mode (For Custom Storage)

Installation

sled-storage is optional. So in Cargo.toml:

[dependencies]
gluesql = { version = "0.4", default-features = false, features = ["alter-table"] }

# alter-table is optional.
# If your DB does not have plan to support ALTER TABLE, then use this below.
gluesql = { version = "0.4", default-features = false }

Usage

There are two required 2 traits for using GlueSQL: Store and StoreMut. In src/store/mod.rs,

pub trait Store<T: Debug> {
    async fn fetch_schema(..) -> ..;
    async fn scan_data(..) -> ..;
}

pub trait StoreMut<T: Debug> where Self: Sized {
    async fn insert_schema(..) -> ..;
    async fn delete_schema(..) -> ..;
    async fn insert_data(..) -> ..;
    async fn update_data(..) -> ..;
    async fn delete_data(..) -> ..;
}

.. there is also a single, optional trait: In src/store/alter_table.rs,

pub trait AlterTable where Self: Sized {
    async fn rename_schema(..) -> ..;
    async fn rename_column(..) -> ..;
    async fn add_column(..) -> ..;
    async fn drop_column(..) -> ..;
}

Examples - GlueSQL-js

Use SQL in web browsers! GlueSQL-js provides 3 storage options,

  • in-memory
  • localStorage
  • sessionStorage.

SQL Features

GlueSQL currently supports a limited subset of queries. It's being actively developed.

  • CREATE with 4 types: INTEGER, FLOAT, BOOLEAN, TEXT with an optional NULL attribute.
  • ALTER TABLE with 4 operations: ADD COLUMN, DROP COLUMN, RENAME COLUMN and RENAME TO.
  • INSERT, UPDATE, DELETE, SELECT, DROP TABLE
  • GROUP BY, HAVING
  • Nested select, join, aggregations ...

You can see tests for the currently supported queries in src/tests/*.

Other expected use cases

  • Run SQL in web browsers - gluesql-js It would be cool to make a state management library using gluesql-js.
  • Add SQL layer to NoSQL databases: Redis, CouchDB...
  • Build new SQL database management system

Contribution

GlueSQL is still in the very early stages of development. Please feel free to contribute however you'd like! The only thing you need to be aware of is...

  • Except for src/glue.rs, src/tests/ and src/utils/, using the mut keyword is discouraged.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].