Git Product home page Git Product logo

kipsql's Introduction

KipSQL

Lightweight SQL calculation engine, as the SQL layer of KipDB, implemented with TalentPlan's TinySQL as the reference standard

Architecture

architecture

Get Started

组件引入

kip-sql = "0.0.1-alpha.0"

Install rust toolchain first.

cargo run

test command

create table t1 (a int primary key, b int);

insert into t1 (a, b) values (1, 1), (5, 3), (6, 2);

update t1 set a = 0 where b > 1;

delete from t1 where b > 1;

select * from t1;

select * from t1 order by a asc nulls first

select count(distinct a) from t1;

truncate table t1;

drop table t1;

Using KipSQL in code

let kipsql = Database::with_kipdb("./data").await?;

let tupes = db.run("select * from t1").await?;

Storage Support:

  • KipDB
  • Memory

demo

Features

  • ORM Mapping
#[derive(Debug, Clone, Default)]
pub struct Post {
    pub post_title: String,
    pub post_date: NaiveDateTime,
    pub post_body: String,
}

implement_from_tuple!(Post, (
    post_title: String => |post: &mut Post, value: DataValue| {
        if let Some(title) = value.utf8() {
            post.post_title = title;
        }
    },
    post_date: NaiveDateTime => |post: &mut Post, value: DataValue| {
        if let Some(date_time) = value.datetime() {
            post.post_date = date_time;
        }
    },
    post_body: String => |post: &mut Post, value: DataValue| {
        if let Some(body) = value.utf8() {
            post.post_body = body;
        }
    }
));
  • SQL field options
    • not null
    • null
    • unique
  • Supports index type
    • Unique Index
  • Supports multiple primary key types
    • Tinyint
    • UTinyint
    • Smallint
    • USmallint
    • Integer
    • UInteger
    • Bigint
    • UBigint
    • Varchar
  • DDL
    • Create
      • Table
      • Index
    • Drop
      • Table
      • Index
    • Truncate
  • DQL
    • Select
      • SeqScan
      • IndexScan
    • Where
    • Distinct
    • Alias
    • Aggregation: count()/sum()/avg()/min()/max()
    • Subquery
    • Join: Inner/Left/Right/Full Cross(x)
    • Group By
    • Having
    • Order By
    • Limit
  • DML
    • Insert
    • Insert Overwrite
    • Update
    • Delete
  • DataTypes
    • Invalid
    • SqlNull
    • Boolean
    • Tinyint
    • UTinyint
    • Smallint
    • USmallint
    • Integer
    • UInteger
    • Bigint
    • UBigint
    • Float
    • Double
    • Varchar
    • Date
    • DateTime
  • Optimizer rules
    • Limit Project Transpose
    • Eliminate Limits
    • Push Limit Through Join
    • Push Limit Into Scan
    • Combine Filters
    • Column Pruning
    • Collapse Project

Thanks For

kipsql's People

Contributors

arlottang avatar eliasyaoyc avatar ge-fighting avatar kkould avatar lewiszlw avatar loloxwg avatar mayingbo avatar sacloudy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.