Skip to content

Commit

Permalink
Merge pull request #19 from lykia-rs/milestone/phase-1
Browse files Browse the repository at this point in the history
Milestone: Phase 1 Completion
  • Loading branch information
can-keklik authored Dec 20, 2023
2 parents f9c15c4 + dd02f63 commit 9fabbd8
Show file tree
Hide file tree
Showing 21 changed files with 539 additions and 344 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Coverage

on: [pull_request, push]

jobs:
coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# λykiaDB
<div style="display: flex;">
<div>

[![CI](https://github.com/lykia-rs/lykiadb/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/lykia-rs/lykiadb/actions/workflows/ci.yml)

</div>
<div>

[![codecov](https://codecov.io/gh/lykia-rs/lykiadb/graph/badge.svg?token=DGIK7BE3K1)](https://codecov.io/gh/lykia-rs/lykiadb)

</div>
</div>

<p align="center">
<img alt="LykiaDB logo" height="200" src="https://vcankeklik.com/assets/img/logo.svg?v=051223">
</p>
Expand Down
2 changes: 1 addition & 1 deletion server/benches/scripts/fib.ly
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Define recursive Fibonacci function
fun fib($n) {
function fib($n) {
if ($n < 2) return $n;
return fib($n - 2) + fib($n - 1);
}
Expand Down
3 changes: 1 addition & 2 deletions server/benches/scripts/while.ly
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ while ($i < 10000000) {
}

$i = 0;

while ($i < 10000000) {
$i = $i + 1;

1 == 1; 1 == 2; 1 == null; 1 == "str"; 1 == true;
null == null; null == 1; null == "str"; null == true;
true == true; true == 1; true == false; true == "str"; true == null;
"str" == "str"; "str" == "stru"; "str" == 1; "str" == null; "str" == true;
}
}
2 changes: 1 addition & 1 deletion server/examples/fib.ly
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Define recursive Fibonacci function
fun fib($n) {
function fib($n) {
if ($n < 2) return $n;
return fib($n - 2) + fib($n - 1);
};
Expand Down
2 changes: 1 addition & 1 deletion server/examples/fn.ly
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fun helloWorld ($message) {
function helloWorld ($message) {
print("Hello world!", $message);
{
{
Expand Down
2 changes: 1 addition & 1 deletion server/examples/scan_err.ly
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Define recursive Fibonacci function
fun fib($n) {
function fib($n) {
if ($n < 2) return $n;
return fib($n - 2) + fib($n - 1);
};
Expand Down
33 changes: 12 additions & 21 deletions server/src/lang/ast/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,30 @@ pub enum SqlExpr {
Default(ExprId),
}

#[derive(Debug, Eq, PartialEq)]
pub enum SqlFrom {
CollectionSubquery(Vec<SqlCollectionSubquery>),
JoinClause(Box<SqlJoinClause>),
}

#[derive(Debug, Eq, PartialEq)]
pub enum SqlProjection {
All,
/*AllFieldsOf{
collection: Token
},*/
Complex { expr: SqlExpr, alias: Option<Token> },
All { collection: Option<Token> },
Expr { expr: SqlExpr, alias: Option<Token> },
}

#[derive(Debug, Eq, PartialEq)]
pub enum SqlJoinClause {
None(SqlCollectionSubquery),
Join(Vec<(SqlJoinType, SqlCollectionSubquery, SqlExpr)>),
pub struct SqlJoin {
pub join_type: SqlJoinType,
pub subquery: SqlCollectionSubquery,
pub join_constraint: Option<SqlExpr>,
}

#[derive(Debug, Eq, PartialEq)]
pub enum SqlCollectionSubquery {
Simple {
Group(Vec<SqlCollectionSubquery>),
Join(Box<SqlCollectionSubquery>, Vec<SqlJoin>),
Collection {
namespace: Option<Token>,
collection: Token,
name: Token,
alias: Option<Token>,
},
From {
from: SqlFrom,
},
Select {
stmt: SqlSelect,
expr: ExprId,
alias: Option<Token>,
},
}
Expand All @@ -80,7 +71,7 @@ pub enum SqlCollectionSubquery {
pub struct SelectCore {
pub distinct: SqlDistinct,
pub projection: Vec<SqlProjection>,
pub from: Option<SqlFrom>,
pub from: Option<SqlCollectionSubquery>,
pub r#where: Option<SqlExpr>,
pub group_by: Option<Vec<SqlExpr>>,
pub having: Option<SqlExpr>,
Expand Down
Loading

0 comments on commit 9fabbd8

Please sign in to comment.