@bejibun/database 0.1.0 → 0.1.1
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.
- package/CHANGELOG.md +1 -1
- package/README.md +2 -31
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file.
|
|
|
3
3
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
## [v0.1.
|
|
6
|
+
## [v0.1.1](https://github.com/crenata/bejibun-database/compare/v0.1.0...v0.1.1) - 2025-10-22
|
|
7
7
|
|
|
8
8
|
### 🩹 Fixes
|
|
9
9
|
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
11
|
# Database for Bejibun
|
|
12
|
-
Database
|
|
12
|
+
Database for Bejibun Framework.
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
@@ -55,38 +55,9 @@ You can pass the value with environment variables.
|
|
|
55
55
|
How to use tha package.
|
|
56
56
|
|
|
57
57
|
```ts
|
|
58
|
-
import type {DatabasePipeline} from "@bejibun/database/types";
|
|
59
|
-
import BaseController from "@bejibun/core/bases/BaseController";
|
|
60
|
-
import Logger from "@bejibun/logger";
|
|
61
58
|
import Database from "@bejibun/database";
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
public async database(request: Bun.BunRequest): Promise<Response> {
|
|
65
|
-
await Database.set("database", {hello: "world"});
|
|
66
|
-
const database = await Database.get("database");
|
|
67
|
-
|
|
68
|
-
await Database.connection("local").set("connection", "This is using custom connection.");
|
|
69
|
-
const connection = await Database.connection("local").get("connection");
|
|
70
|
-
|
|
71
|
-
const pipeline = await Database.pipeline((pipe: DatabasePipeline) => {
|
|
72
|
-
pipe.set("database-pipeline-1", "This is database pipeline 1");
|
|
73
|
-
pipe.set("database-pipeline-2", "This is database pipeline 2");
|
|
74
|
-
|
|
75
|
-
pipe.get("database-pipeline-1");
|
|
76
|
-
pipe.get("database-pipeline-2");
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const subscriber = await Database.subscribe("database-subscribe", (message: string, channel: string) => {
|
|
80
|
-
Logger.setContext(channel).debug(message);
|
|
81
|
-
});
|
|
82
|
-
await Database.publish("database-subscribe", "Hai database subscriber!");
|
|
83
|
-
setTimeout(async () => {
|
|
84
|
-
await subscriber.unsubscribe();
|
|
85
|
-
}, 500);
|
|
86
|
-
|
|
87
|
-
return super.response.setData({database, connection, pipeline}).send();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
60
|
+
Database.knex();
|
|
90
61
|
```
|
|
91
62
|
|
|
92
63
|
## Contributors
|