Skip to content

Commit fa7d24e

Browse files
committed
Add Model
1 parent 97d1877 commit fa7d24e

File tree

45 files changed

+1849
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1849
-179
lines changed

Cargo.lock

Lines changed: 214 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[workspace]
22
resolver = "2"
3-
members = ["core/utils", "core/api", "libs/python/core", "sql/core/*", "sql/libs/*/*"]
3+
members = ["core/*", "libs/python/core", "sql/core/*", "sql/libs/*/*"]

__tests__/sql/index.test.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { createSqliteConnection } from '@devup-sql/sqlite'
2+
describe('sqlite', async () => {
3+
const pool = await createSqliteConnection({
4+
url: 'sqlite::memory:',
5+
})
6+
it.each([
7+
['SELECT 1 as value', { value: 1 }],
8+
['SELECT NULL as value', { value: null }],
9+
['SELECT "A" as value', { value: 'A' }],
10+
['SELECT TRUE as value', { value: 1 }],
11+
['SELECT FALSE as value', { value: 0 }],
12+
['SELECT 1.1 as value', { value: 1.1 }],
13+
])('should select one row', async (sql, expected) => {
14+
expect(await pool.fetchOne(sql)).toEqual(expected)
15+
})
16+
it.each([
17+
['SELECT 1 as value', [{ value: 1 }]],
18+
['SELECT NULL as value', [{ value: null }]],
19+
['SELECT "A" as value', [{ value: 'A' }]],
20+
['SELECT TRUE as value', [{ value: 1 }]],
21+
['SELECT FALSE as value', [{ value: 0 }]],
22+
['SELECT 1.1 as value', [{ value: 1.1 }]],
23+
])('should select all', async (sql, expected) => {
24+
expect(await pool.fetchAll(sql)).toEqual(expected)
25+
})
26+
it.each([
27+
['SELECT NULL as value', { value: null }],
28+
['SELECT "A" as value', { value: 'A' }],
29+
['SELECT TRUE as value', { value: 1 }],
30+
['SELECT FALSE as value', { value: 0 }],
31+
['SELECT 1.1 as value', { value: 1.1 }],
32+
])('should select optional', async (sql, expected) => {
33+
expect(await pool.fetchOptional(sql)).toEqual(expected)
34+
})
35+
describe('model', () => {
36+
// @Model()
37+
// class User {
38+
// @Column(String, {
39+
// primaryKey: true,
40+
// autoincrement: true,
41+
// })
42+
// id: number
43+
// @Column(String)
44+
// name: string
45+
// }
46+
it('test', async () => {
47+
expect(0).toEqual(0)
48+
})
49+
})
50+
})

core/model/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pub mod column;
22
pub mod utils;
33

4-
use column::DevupModelFieldType;
4+
pub use column::DevupModelFieldType;
55
use serde::{Deserialize, Serialize};
66

77
#[derive(Debug, Serialize, Deserialize, Clone)]

core/storage/Cargo.toml

Lines changed: 0 additions & 10 deletions
This file was deleted.

core/storage/src/lib.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)