-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
60 lines (46 loc) · 1.04 KB
/
test.js
File metadata and controls
60 lines (46 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const { Client, Schema, Types } = require("./dist/index");
console.log(new Types.ID().toString());
const client = new Client();
/**
* Create a new schema
*/
const schema = new Schema({
name: String,
age: Number,
createdAt: Date,
updatedAt: Date
});
client.addSchema(schema, "Test");
/**
* Log
*/
const document = client.schemas.Test.create({
name: "John Doe",
age: 25,
createdAt: new Date(),
updatedAt: new Date()
});
document.save();
console.log(client._store);
document.delete();
/**
* Event Listening
*/
// NEW
// UPDATED
// DELETE
// schema.on("new/update/delete", (data) => {});
/**
* Netzwerk "Protokoll" Sockets
*/
// {
// timestamp: Date,
// type: "UPDATED","NEW","DELETE", "QUERY", "ANSWER"
// data: DATA,
// packetNumber: Number,
// sender: String,
// }
// QUERY
// client => server => (broadcast) => clientY ("EY ICH HAB WAS!") => server (schaut sender nach) => client
// UPDATED / NEW / DELETE
// client => server => (broadcast) => client ('ich lösch was/aktualisiere/etc);