Data types: Backend DB architecture
In this post, the data types that represent the entities mentioned in "Backend DB architecture" would be presented. The language is Typescript running in Node.
The `labels` array contains all labels that could happen on any of the `Post`s.
Sample Channel record:
Sample Post record:
Lets start with the Client:
export class Client {
public id : number;
public name : string;
labels : string[];
constructor () {
}
}
The `labels` array contains all labels that could happen on any of the `Post`s.
A `Client` could have any number of `Channel`s associated with it. The `_client_ref` points to the `Client`::
import { Client } from "./client";
export class Channel {
public client : number;
public id : number;
public name : string;
public _client_ref : Client;
constructor (client:Client) {
this._client_ref = client;
}
}
Each `Channel` could have any number of `Post`s:
import { Client } from "./client";
import { Channel } from "./channel";
export class Post {
public client : number;
public channel : number;
public id : number
public created_date : number;
public text : string;
public post_type : "TEXT" | "IMAGE" | "VIDEO" | "LINK";
public labels: string [];
public insights: number[];
public _client_ref : Client;
public _channel_ref : Channel;
private static _sequence : number = 0;
constructor(client:Client, channel:Channel) {
this._client_ref = client;
this._channel_ref = channel;
}
}
Having the data types - lets create a "Random data generator" that dumps JSON and CSV files with random data.
Sample data
Sample Client record:
{
"id": 0,
"name": "BJ Services Company",
"labels": [
"otuko",
"umereb",
"sibaforov",
"muc",
"gopinos",
"ciifiiso",
"zik",
"okopumi",
"co",
"zirlipwoc",
"mevib",
"ta",
"dulo",
"loes",
"tuzdam",
"hifu",
"me",
"wuhtewvov",
"fe",
"dov",
"dolla"
]
}
Sample Channel record:
{
"id": 0,
"client": 4303,
"name": "@zocuw"
},
Sample Post record:
{
"client": 1206,
"channel": 39523,
"id": 8,
"created_date": 1516330376000,
"text": "Wumhem uguve olaro nisid rululfup barekfiz jagnu gobum goj ja fajike tedicuk.",
"post_type": "LINK",
"labels": [
"fo",
"wuvjulaz",
"zihubju",
"zaokosi",
"hosmerab",
"kakdatwuf",
"junbi",
"zinekaku",
"rujsiov"
],
"insights": [
100005,
657875,
169162,
689672,
988617,
848863,
506110,
770147,
47568,
712479,
650352,
900524,
973183,
217062,
754424,
711652,
924751,
286921,
363574,
653247,
126344,
832025,
806129,
976228,
66144,
588530,
108403,
817070,
136224,
2204,
422520,
383058,
245412,
761675,
585509,
530694,
452252,
592180,
158107,
265906,
223294,
584236,
36081,
886935,
184333,
811952,
452309,
566509,
997581,
924844,
667776,
637752,
853350,
153983,
684913,
825527,
65640,
277361,
735523,
153490,
892049,
469048,
631845,
517898,
93978,
507148,
455821,
955607,
316781,
89193,
826140,
375440,
760106,
930582,
961828,
298912,
57130,
617704,
159721,
162534,
99695,
130321,
433671,
278697,
149232,
632954,
245728,
567359,
693463,
159013,
383417,
593730,
227523,
782458,
997559,
276812,
353369,
685802,
416554,
548174
]
}
Table of Contents for the series
- Requirements
- Data types
- Generate random CSV/JSON data (TBD..)
- Query Interface (TBD..)
- Linear scanner (TBD..)
Comments
Post a Comment