duckdb-tinyorm 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +34 -36
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,35 +1,34 @@
1
1
  # DuckDB Tiny ORM
2
2
 
3
3
  Usage:
4
- ```typescript
5
4
 
6
- import { DuckDbRepository, Entity, Repository, DataTypeDecorator, BaseRepository, Id } from 'duckdb-tinyorm';
5
+ ```typescript
7
6
 
8
7
  import 'reflect-metadata';
8
+ import { DuckDbRepository, Entity, Repository, DataTypeDecorator, BaseRepository, Id } from 'duckdb-tinyorm';
9
9
 
10
10
  @Entity
11
- export class Amenity {
12
-
13
- @DataTypeDecorator('VARCHAR')
14
- Name?: string = null;
11
+ export class Subject {
15
12
 
16
13
  @Id()
17
14
  @DataTypeDecorator('VARCHAR')
18
- Type?: string = null;
15
+ Id?: string = null;
19
16
 
20
17
  @DataTypeDecorator('VARCHAR')
21
- PropertyId?: string = null;
18
+ Name?: string = null;
19
+
22
20
 
23
21
  @DataTypeDecorator('VARCHAR')
24
- Color?: string = null;
22
+ Description?: string = null;
23
+
25
24
 
26
25
  @DataTypeDecorator('INT')
27
26
  Year?: number = null;
28
27
 
29
28
  }
30
29
 
31
- @Repository(Amenity)
32
- class AmenityRepository extends BaseRepository<Amenity, string> {
30
+ @Repository(Subject)
31
+ class SubjectRepository extends BaseRepository<Subject, string> {
33
32
  constructor() {
34
33
  super(DuckDbRepository.getInstances());
35
34
  }
@@ -37,33 +36,32 @@ class AmenityRepository extends BaseRepository<Amenity, string> {
37
36
 
38
37
 
39
38
  async function test() {
40
- const amenityRepository = new AmenityRepository();
41
-
42
- const amenity = new Amenity();
43
- amenity.Name = "Name1";
44
- amenity.PropertyId = "1";
45
- amenity.Type = "Type1";
46
- amenity.Color = "Green";
47
- amenity.Year = 2022;
48
-
49
-
50
- const amenity1= new Amenity();
51
- amenity1.Name = "Name2";
52
- amenity1.PropertyId = "2";
53
- amenity1.Type = "Type2";
54
- amenity.Color = "Green";
55
- amenity.Year = 2022;
56
-
57
- await amenityRepository.save(amenity);
58
- await amenityRepository.save(amenity1);
59
- const result = await amenityRepository.findAll();
39
+ const subjectRepository = new SubjectRepository();
40
+
41
+ const subject1 = new Subject();
42
+ subject1.Name = "Java Basic";
43
+ subject1.Description = "Java Basic";
44
+ subject1.Year = 2024;
45
+ subject1.Id = "JB"
46
+
47
+
48
+ const subject2 = new Subject();
49
+ subject2.Name = "Java OOP";
50
+ subject2.Description = "Java Object Oriented Programming";
51
+ subject2.Year = 2024;
52
+ subject2.Id = "OOP"
53
+
54
+
55
+ await subjectRepository.save(subject1);
56
+ await subjectRepository.save(subject2);
57
+ const result = await subjectRepository.findAll();
60
58
  console.table(result);
61
- const amenityFound:Amenity = await amenityRepository.findById("Type1");
62
- console.info(amenityFound);
63
- const amenityFound1: Amenity = await amenityRepository.findById("Type1");
64
- console.info(amenityFound1);
59
+ const subjectFound1:Subject = await subjectRepository.findById("JB");
60
+ console.info(subjectFound1);
61
+ const subjectFound2: Subject = await subjectRepository.findById("OOP");
62
+ console.info(subjectFound2);
65
63
 
66
- const amenities = await amenityRepository.findBy(amenity, ["Color"]);
64
+ const amenities = await subjectRepository.findBy({Year: 2024}, ["Year"]);
67
65
  console.table(amenities);
68
66
  }
69
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "duckdb-tinyorm",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "TinyORM for Duckdb, easy setup",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",