tspace-mysql 1.3.3 → 1.3.5

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/README.md CHANGED
@@ -26,7 +26,8 @@ npm install tspace-mysql --save
26
26
  - [One To Many](#one-to-many)
27
27
  - [Belongs To](#belongs-to)
28
28
  - [Many To Many](#many-to-many)
29
- - [Relation in Relation](#relation-in-relation)
29
+ - [Deeply Nested Relations](#deeply-nested-relations)
30
+ - [Relation Exists](#relation-exists)
30
31
  - [Built in Relation Functions](#built-in-relation-functions)
31
32
  - [Query Builder](#query-builder)
32
33
  - [Cli](#cli)
@@ -38,7 +39,7 @@ npm install tspace-mysql --save
38
39
  - [Blueprint](#blueprint)
39
40
 
40
41
  ## Configuration
41
- Created your environment variables is to use a .env file, you may establish a connection is this:
42
+ Created your environment variables is to use a '.env' file, you may establish a connection is this:
42
43
  ```js
43
44
  DB_HOST = localhost
44
45
  DB_PORT = 3306
@@ -54,6 +55,22 @@ DB_DATABASE = database
54
55
  * DB_TIMEOUT = 60000
55
56
  * DB_DATE_STRINGS = true
56
57
  */
58
+ ```
59
+ Or you can created file name 'db.tspace' to use a connection this:
60
+ ```js
61
+ source db {
62
+ host = localhost
63
+ port = 3306
64
+ database = npm
65
+ user = root
66
+ password =
67
+ connectionLimit = 10
68
+ dateStrings = true
69
+ connectTimeout = 60000
70
+ waitForConnections = true
71
+ queueLimit = 0
72
+ charset = utf8mb4
73
+ }
57
74
 
58
75
  ```
59
76
  ## Running Queries
@@ -112,9 +129,9 @@ await new DB('users').groupBy('id','usernamename').findOne()
112
129
 
113
130
  Running A Join Query
114
131
  ```js
115
- await new DB('posts').join('posts.user_id' , 'users.id').findOne()
116
- await new DB('posts').leftJoin('posts.user_id' , 'users.id').findOne()
117
- await new DB('posts').rightJoin('posts.user_id' , 'users.id').findOne()
132
+ await new DB('posts').join('posts.user_id' , 'users.id').findMany()
133
+ await new DB('posts').leftJoin('posts.user_id' , 'users.id').findMany()
134
+ await new DB('posts').rightJoin('posts.user_id' , 'users.id').findMany()
118
135
  ```
119
136
 
120
137
  Running A Where Query
@@ -386,22 +403,32 @@ class User extends Model {
386
403
  * createdAt : 'created_at',
387
404
  * updatedAt : 'updated_at'
388
405
  * }) // runing a timestamp when insert or update
389
- * this.useSoftDelete()
406
+ * this.useSoftDelete('deletedAt') // => default target to colmun deleted_at
390
407
  * this.useTable('users')
391
- * this.useTableSingular() // 'user'
392
- * this.useTablePlural() // 'users'
393
- * this.usePattern('snake_case')
408
+ * this.useTableSingular() // => 'user'
409
+ * this.useTablePlural() // => 'users'
410
+ * this.usePattern('snake_case') // => default 'snake_case'
394
411
  * this.useUUID('uuid') // => runing a uuid (universally unique identifier) when insert new data
395
- * this.useRegistry()
396
- * this.useLoadRelationInRegistry()
397
- * this.useBuiltInRelationFunctions()
412
+ * this.useRegistry() // => build-in functions registry
413
+ * this.useLoadRelationsInRegistry() // => auto generated results from relationship to results
414
+ * this.useBuiltInRelationFunctions() // => build-in functions relationships to results
398
415
  * this.useSchema({
399
416
  * id : Number,
400
417
  * username : String
401
418
  * created_at : Date,
402
419
  * updated_at : Date,
403
- * }) // validate type of schema when return results
404
- */
420
+ * }) // => validate type of schema when return results
421
+ * this.useCreateTableIfNotExists ({
422
+ * id : new Blueprint().int().notNull().primary().autoIncrement(),
423
+ * uuid : new Blueprint().varchar(50).null(),
424
+ * user_id : new Blueprint().int().notNull(),
425
+ * title : new Blueprint().varchar(255).null(),
426
+ * created_at : new Blueprint().timestamp().null(),
427
+ * updated_at : new Blueprint().timestamp().null(),
428
+ * deleted_at : new Blueprint().timestamp().null()
429
+ * })
430
+ */
431
+
405
432
 
406
433
  /*
407
434
  * the "snake case", plural name of the class will be used as the table name
@@ -508,7 +535,7 @@ class Phone extends Model {
508
535
  }
509
536
  /**
510
537
  *
511
- * @belongsToQuery Get the user that owns the phone.. using function callback
538
+ * @belongsToBuilder Get the user that owns the phone.. using function callback
512
539
  * @function
513
540
  */
514
541
  user (callback ?: Function) {
@@ -543,7 +570,7 @@ class User extends Model {
543
570
  this.belognsToMany({ name : 'roles' , model : Role })
544
571
  }
545
572
  /**
546
- * @belongsToQuery Get the user that owns the phone.. using function callback
573
+ * @belongsToBuilder Get the user that owns the phone.. using function callback
547
574
  * @function
548
575
  */
549
576
  roles (callback ?: Function) {
@@ -561,8 +588,8 @@ const userUsingFunction = await new User().roles().findOne()
561
588
  // user?.roles => [{...}]
562
589
  ```
563
590
 
564
- ## Relation in Relation
565
- Relationships can deep relations.
591
+ ## Deeply Nested Relations
592
+ Relationships can deeply relations.
566
593
  let's example a deep in relations :
567
594
  ```js
568
595
  import { Model } from 'tspace-mysql'
@@ -590,8 +617,9 @@ class Comment extends Model {
590
617
  }
591
618
  }
592
619
  +--------------------------------------------------------------------------+
620
+ // Deeply nested relations
593
621
  await new User().relations('posts')
594
- .relationQuery('posts', (query : Post) => { // relationQuery return a callback query in model registry
622
+ .relationQuery('posts', (query : Post) => {
595
623
  return query.relations('comments','user')
596
624
  .relationQuery('comments', (query : Comment) => {
597
625
  return query.relations('user','post')
@@ -604,6 +632,129 @@ await new User().relations('posts')
604
632
  })
605
633
  })
606
634
  .findMany()
635
+
636
+ // Select some columns in nested relations
637
+ await new User().relations('posts')
638
+ .relationQuery('posts', (query : Post) => query.select('id','user_id','title'))
639
+ .findMany()
640
+
641
+ // Where some columns in nested relations
642
+ await new User().relations('posts')
643
+ .relationQuery('posts', (query : Post) => query.whereIn('id',[1,3,5]))
644
+ .findMany()
645
+
646
+ // Sort data in nested relations
647
+ await new User().relations('posts')
648
+ .relationQuery('posts', (query : Post) => query.latest('id'))
649
+ .findMany()
650
+
651
+ // Limit data in nested relations
652
+ await new User().relations('posts')
653
+ .relationQuery('posts', (query : Post) => {
654
+ return query
655
+ .limit(1)
656
+ .relations('comments')
657
+ .relationQuery('comments', (query : Comment) => query.limit(1))
658
+ })
659
+ .findMany()
660
+
661
+ ```
662
+ ## Relation Exists
663
+ Relationships can return only result is not isempty related with soft delete.
664
+ let's example a exists in relations :
665
+ ```js
666
+ +-------------+--------------+----------------------------+--------------------+
667
+ | table users | |
668
+ +-------------+--------------+----------------------------+--------------------+
669
+ | id | username | email | deleted_at |
670
+ |-------------|--------------|----------------------------|--------------------|
671
+ | 1 | tspace1 | tspace1@gmail.com | |
672
+ | 2 | tspace2 | tspace2@gmail.com | |
673
+ | 3 | tspace3 | tspace3@gmail.com | |
674
+ +-------------+--------------+----------------------------+--------------------+
675
+
676
+
677
+ +-------------+--------------+----------------------------+--------------------+
678
+ | table posts | |
679
+ +-------------+--------------+----------------------------+--------------------+
680
+ | id | user_id | title | deleted_at |
681
+ |-------------|--------------|----------------------------|--------------------|
682
+ | 1 | 1 | posts 1 |2020-07-15 00:00:00 |
683
+ | 2 | 2 | posts 2 | |
684
+ | 3 | 3 | posts 3 |2020-07-15 00:00:00 |
685
+ +-------------+--------------+----------------------------+--------------------+
686
+
687
+ import { Model } from 'tspace-mysql'
688
+
689
+ class User extends Model {
690
+ constructor(){
691
+ super()
692
+ this.hasMany({ name : 'posts' , model : Post })
693
+ this.useSoftDelete()
694
+ }
695
+ }
696
+
697
+ +--------------------------------------------------------------------------+
698
+
699
+ class Post extends Model {
700
+ constructor(){
701
+ super()
702
+ this.hasMany({ name : 'comments' , model : Comment })
703
+ this.belongsTo({ name : 'user' , model : User })
704
+ this.useSoftDelete()
705
+ }
706
+ }
707
+ // normal relations
708
+ await new User().relations('posts').findMany()
709
+ /*
710
+ * @returns [
711
+ * {
712
+ * id : 1,
713
+ * username: "tspace1",
714
+ * email : "tspace1@gmail.com",
715
+ * posts : []
716
+ * },
717
+ * {
718
+ * id : 2,
719
+ * username: "tspace2",
720
+ * email : "tspace2@gmail.com",
721
+ * posts : [
722
+ * {
723
+ * id : 2,
724
+ * user_id : 2,
725
+ * title : "posts 2"
726
+ * }
727
+ * ]
728
+ * },
729
+ * {
730
+ * id : 3,
731
+ * username: "tspace3",
732
+ * email : "tspace3@gmail.com",
733
+ * posts : []
734
+ * }
735
+ * ]
736
+ */
737
+
738
+ await new User().relationsExists('posts').findMany()
739
+ /*
740
+ * @returns [
741
+ * {
742
+ * id : 2,
743
+ * username: "tspace2",
744
+ * email : "tspace2@gmail.com",
745
+ * posts : [
746
+ * {
747
+ * id : 2,
748
+ * user_id : 2,
749
+ * title : "posts 2"
750
+ * }
751
+ * ]
752
+ * }
753
+ * ]
754
+ * because posts id 1 and id 3 has been removed from database using soft delete
755
+ */
756
+
757
+
607
758
  ```
608
759
 
609
760
  ## Built in Relation Functions
@@ -16,6 +16,8 @@ export declare class PoolConnection {
16
16
  connection(): Connection;
17
17
  private _defaultOptions;
18
18
  private _loadOptions;
19
+ private _convertStringToObject;
20
+ private _covertKeyTypeToCorrectType;
19
21
  private _messageError;
20
22
  }
21
23
  /**
@@ -34,7 +34,7 @@ class PoolConnection {
34
34
  return;
35
35
  const message = this._messageError.bind(this);
36
36
  process.nextTick(() => {
37
- console.log(message());
37
+ console.log(message(err === null || err === void 0 ? void 0 : err.message));
38
38
  return process.exit();
39
39
  });
40
40
  });
@@ -79,65 +79,114 @@ class PoolConnection {
79
79
  }
80
80
  _defaultOptions() {
81
81
  return new Map(Object.entries({
82
- connectionLimit: Number(options_1.default.CONNECTION_LIMIT),
82
+ connectionLimit: Number.isNaN(Number(options_1.default.CONNECTION_LIMIT)) ? 30 : Number(options_1.default.CONNECTION_LIMIT),
83
83
  dateStrings: Boolean(options_1.default.DATE_STRINGS),
84
- connectTimeout: Number(options_1.default.TIMEOUT),
84
+ connectTimeout: Number.isNaN(Number(options_1.default.TIMEOUT)) ? 60 * 1000 : Number(options_1.default.TIMEOUT),
85
85
  waitForConnections: Boolean(options_1.default.WAIT_FOR_CONNECTIONS),
86
- queueLimit: Number(options_1.default.QUEUE_LIMIT),
87
- multipleStatements: true,
86
+ queueLimit: Number.isNaN(Number(options_1.default.QUEUE_LIMIT) ? 0 : Number(options_1.default.QUEUE_LIMIT)),
88
87
  charset: String(options_1.default.CHARSET),
89
88
  host: String(options_1.default.HOST),
90
- port: Number.isNaN(Number(options_1.default.PORT))
91
- ? 3306
92
- : Number(options_1.default.PORT),
89
+ port: Number.isNaN(Number(options_1.default.PORT)) ? 3306 : Number(options_1.default.PORT),
93
90
  database: String(options_1.default.DATABASE),
94
91
  user: String(options_1.default.USERNAME),
95
- password: String(options_1.default.PASSWORD) !== ''
96
- ? String(options_1.default.PASSWORD)
97
- : ''
92
+ password: String(options_1.default.PASSWORD) === '' ? '' : String(options_1.default.PASSWORD),
93
+ multipleStatements: options_1.default.MULTIPLE_STATEMENTS || false,
94
+ enableKeepAlive: options_1.default.ENABLE_KEEP_ALIVE || false,
95
+ keepAliveInitialDelay: options_1.default.KEEP_ALIVE_DELAY || 0,
98
96
  }));
99
97
  }
100
98
  _loadOptions() {
101
99
  try {
102
100
  /**
103
- *
104
- * @Json connection
105
- *
106
- "host" : "",
107
- "port" : "",
108
- "database" : "",
109
- "user" : "",
110
- "password" : "",
111
- "connectionLimit" : "",
112
- "dateStrings" : "",
113
- "idleTimeout" : "",
114
- "waitForConnections" : "",
115
- "queueLimit" : "",
116
- "charset" : ""
101
+ * @source data
102
+ * source db {
103
+ * host = localhost
104
+ * port = 3306
105
+ * database = npm
106
+ * user = root
107
+ * password =
108
+ * connectionLimit =
109
+ * dateStrings =
110
+ * connectTimeout =
111
+ * waitForConnections =
112
+ * queueLimit =
113
+ * charset =
114
+ * }
117
115
  */
118
- const jsonPath = path_1.default.join(path_1.default.resolve(), 'tspace-mysql.json');
119
- const jsonOptionsExists = fs_1.default.existsSync(jsonPath);
120
- if (!jsonOptionsExists)
116
+ const dbOptionsPath = path_1.default.join(path_1.default.resolve(), 'db.tspace');
117
+ const dbOptionsExists = fs_1.default.existsSync(dbOptionsPath);
118
+ if (!dbOptionsExists)
119
+ return this._defaultOptions();
120
+ const dbOptions = fs_1.default.readFileSync(dbOptionsPath, 'utf8');
121
+ const options = this._convertStringToObject(dbOptions);
122
+ if (options == null)
121
123
  return this._defaultOptions();
122
- const jsonOptions = fs_1.default.readFileSync(jsonPath, 'utf8');
123
- const options = JSON.parse(jsonOptions);
124
124
  return new Map(Object.entries(options));
125
125
  }
126
126
  catch (e) {
127
127
  return this._defaultOptions();
128
128
  }
129
129
  }
130
- _messageError() {
130
+ _convertStringToObject(str, target = 'db') {
131
+ if (str.toLocaleLowerCase().includes('#ignore'))
132
+ return null;
133
+ str = str.trim();
134
+ const sources = str.split('\n\n');
135
+ if (!sources.length)
136
+ return null;
137
+ const lines = sources[0].split('\r\n');
138
+ if (!lines.length)
139
+ return null;
140
+ const sourceObj = {};
141
+ let targetKey = '';
142
+ for (const line of lines) {
143
+ let [key, value] = line.split('=');
144
+ const sourceKey = key.match(/source\s+(\w+)/);
145
+ const sourceKeyClose = key.match(/}/g);
146
+ if (sourceKey != null) {
147
+ targetKey = sourceKey[1];
148
+ continue;
149
+ }
150
+ if (sourceKeyClose != null && sourceKeyClose.length) {
151
+ targetKey = '';
152
+ continue;
153
+ }
154
+ if (key == null || value == null)
155
+ continue;
156
+ key = key.trim();
157
+ value = value.trim();
158
+ if (!sourceObj.hasOwnProperty(targetKey))
159
+ sourceObj[targetKey] = {};
160
+ sourceObj[targetKey][key] = value;
161
+ }
162
+ return this._covertKeyTypeToCorrectType(sourceObj[target]) || null;
163
+ }
164
+ _covertKeyTypeToCorrectType(data) {
165
+ for (const [key, value] of Object.entries(data)) {
166
+ if (value == null)
167
+ continue;
168
+ if (typeof value === 'string' && ['true', 'false'].some(v => value.toLowerCase() === v)) {
169
+ data[key] = JSON.parse(value.toLowerCase());
170
+ continue;
171
+ }
172
+ if (/^[0-9]+$/.test(value))
173
+ data[key] = +value;
174
+ }
175
+ return data;
176
+ }
177
+ _messageError(err) {
131
178
  return `
132
179
  \x1b[1m\x1b[31m
133
180
  Connection lost to database ! \x1b[0m
134
- --------------------------------- \x1b[33m
181
+ ------------------------------- \x1b[33m
135
182
  HOST : ${this.OPTIONS.get('host')}
136
183
  PORT : ${this.OPTIONS.get('port')}
137
184
  DATABASE : ${this.OPTIONS.get('database')}
138
185
  USERNAME : ${this.OPTIONS.get('user')}
139
- PASSWORD : ${this.OPTIONS.get('password')} \x1b[0m
140
- ---------------------------------
186
+ PASSWORD : ${this.OPTIONS.get('password')} \x1b[0m
187
+ -------------------------------
188
+ \x1b[1m\x1b[31mError Message
189
+ : ${err !== null && err !== void 0 ? err : ''} \x1b[0m
141
190
  `;
142
191
  }
143
192
  }
@@ -1,15 +1,19 @@
1
1
  declare const _default: Readonly<{
2
+ [x: string]: any;
2
3
  HOST?: string | null | undefined;
3
4
  PORT?: string | number | undefined;
4
- USERNAME?: string | undefined;
5
- PASSWORD?: string | undefined;
6
- DATABASE?: string | undefined;
5
+ USERNAME?: string | null | undefined;
6
+ PASSWORD?: string | null | undefined;
7
+ DATABASE?: string | null | undefined;
7
8
  CONNECTION_LIMIT?: string | number | undefined;
8
9
  QUEUE_LIMIT?: string | number | undefined;
9
10
  TIMEOUT?: string | number | undefined;
10
- CHARSET?: string | undefined;
11
+ CHARSET?: string | null | undefined;
11
12
  CONNECTION_ERROR?: string | boolean | undefined;
12
13
  WAIT_FOR_CONNECTIONS?: string | boolean | undefined;
13
14
  DATE_STRINGS?: string | boolean | undefined;
15
+ KEEP_ALIVE_DELAY?: string | number | undefined;
16
+ ENABLE_KEEP_ALIVE?: string | boolean | undefined;
17
+ MULTIPLE_STATEMENTS?: string | boolean | undefined;
14
18
  }>;
15
19
  export default _default;
@@ -24,20 +24,25 @@ const env = {
24
24
  USERNAME: process.env.DB_USERNAME || process.env.TSPACE_USERNAME,
25
25
  PASSWORD: process.env.DB_PASSWORD || process.env.TSPACE_PASSWORD || '',
26
26
  DATABASE: process.env.DB_DATABASE || process.env.TSPACE_DATABASE,
27
- CONNECTION_LIMIT: process.env.DB_CONNECTION_LIMIT || process.env.TSPACE_CONNECTION_LIMIT || 10,
27
+ CONNECTION_LIMIT: process.env.DB_CONNECTION_LIMIT || process.env.TSPACE_CONNECTION_LIMIT || 30,
28
28
  QUEUE_LIMIT: process.env.DB_QUEUE_LIMIT || process.env.TSPACE_QUEUE_LIMIT || 0,
29
29
  TIMEOUT: process.env.DB_TIMEOUT || process.env.TSPACE_TIMEOUT || 1000 * 60,
30
30
  CHARSET: process.env.DB_CHARSET || process.env.TSPACE_CHARSET || 'utf8mb4',
31
31
  CONNECTION_ERROR: process.env.DB_CONNECTION_ERROR || process.env.TSPACE_CONNECTION_ERROR || true,
32
32
  WAIT_FOR_CONNECTIONS: process.env.DB_WAIT_FOR_CONNECTIONS || process.env.TSPACE_WAIT_FOR_CONNECTIONS || true,
33
- DATE_STRINGS: process.env.DB_DATE_STRINGS || process.env.TSPACE_DATE_STRINGS || true
33
+ DATE_STRINGS: process.env.DB_DATE_STRINGS || process.env.TSPACE_DATE_STRINGS || true,
34
+ KEEP_ALIVE_DELAY: process.env.DB_KEEP_ALIVE_DELAY || process.env.TSPACE_KEEP_ALIVE_DELAY || 0,
35
+ ENABLE_KEEP_ALIVE: process.env.DB_ENABLE_KEEP_ALIVE || process.env.TSPACE_ENABLE_KEEP_ALIVE || false,
36
+ MULTIPLE_STATEMENTS: process.env.MULTIPLE_STATEMENTS || process.env.TSPACE_MULTIPLE_STATEMENTS || false
34
37
  };
35
38
  for (const [key, value] of Object.entries(env)) {
36
39
  if (value == null)
37
40
  continue;
38
41
  if (typeof value === 'string' && ['true', 'false'].some(v => value.toLowerCase() === v)) {
39
- const configEnv = env;
40
- configEnv[key] = JSON.parse(value.toLowerCase());
42
+ env[key] = JSON.parse(value.toLowerCase());
43
+ continue;
41
44
  }
45
+ if (/^[0-9]+$/.test(value))
46
+ env[key] = +value;
42
47
  }
43
48
  exports.default = Object.freeze(Object.assign({}, env));
@@ -76,6 +76,9 @@ const CONSTANTS = Object.freeze({
76
76
  snake_case: 'snake_case',
77
77
  camelCase: 'camelCase'
78
78
  },
79
+ DEFAULT: {
80
+ DEBUG: false,
81
+ },
79
82
  DB: {
80
83
  PRIMARY_KEY: 'id',
81
84
  VOID: false,
@@ -156,7 +159,9 @@ const CONSTANTS = Object.freeze({
156
159
  UPDATED_AT: 'updated_at'
157
160
  },
158
161
  SCHEMA: null,
159
- FUNCTION_RELATION: false
162
+ FUNCTION_RELATION: false,
163
+ CREATE_TABLE: null,
164
+ QUERIES: 0
160
165
  }
161
166
  });
162
167
  exports.CONSTANTS = CONSTANTS;
@@ -1,16 +1,12 @@
1
1
  import { Pagination } from './Interface';
2
+ import { StateHandler } from './StateHandler';
2
3
  declare abstract class AbstractBuilder {
3
4
  protected $setters: string[];
4
5
  protected $utils: {
5
6
  [key: string]: Function;
6
7
  };
7
8
  protected $constants: Function;
8
- protected $state: {
9
- original: Function;
10
- get: Function;
11
- set: Function;
12
- clone: Function;
13
- };
9
+ protected $state: StateHandler;
14
10
  protected $pool: {
15
11
  query: Function;
16
12
  set: Function;
@@ -19,6 +15,7 @@ declare abstract class AbstractBuilder {
19
15
  protected $logger: {
20
16
  get: Function;
21
17
  set: (value: string) => void;
18
+ reset: () => void;
22
19
  check: (value: string) => boolean;
23
20
  };
24
21
  protected $attributes: {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractBuilder = void 0;
4
+ const StateHandler_1 = require("./StateHandler");
4
5
  class AbstractBuilder {
5
6
  constructor() {
6
7
  this.$setters = [
@@ -13,12 +14,7 @@ class AbstractBuilder {
13
14
  ];
14
15
  this.$utils = {};
15
16
  this.$constants = (name) => { };
16
- this.$state = {
17
- original: () => { },
18
- get: (key) => { },
19
- set: (key, value) => { },
20
- clone: (data) => { }
21
- };
17
+ this.$state = new StateHandler_1.StateHandler({});
22
18
  this.$pool = {
23
19
  query: (sql) => { },
24
20
  set: (pool) => { },
@@ -27,6 +23,7 @@ class AbstractBuilder {
27
23
  this.$logger = {
28
24
  get: () => { },
29
25
  set: (value) => { },
26
+ reset: () => { },
30
27
  check: (value) => true || false
31
28
  };
32
29
  this.$attributes = null;
@@ -11,6 +11,8 @@ declare abstract class AbstractModel extends Builder {
11
11
  protected abstract useTimestamp(): this;
12
12
  protected abstract useSoftDelete(): this;
13
13
  protected abstract usePattern(pattern: string): this;
14
+ protected abstract useLoadRelationsInRegistry(): this;
15
+ protected abstract useBuiltInRelationFunctions(): this;
14
16
  protected abstract define(): void;
15
17
  protected abstract hasOne({ name, model, localKey, foreignKey, freezeTable, as }: Relation): this;
16
18
  protected abstract hasMany({ name, model, localKey, foreignKey, freezeTable, as }: Relation): this;