Skip to content

Commit 1961169

Browse files
committed
expose more methods and add more comments
1 parent f4e905c commit 1961169

1 file changed

Lines changed: 37 additions & 15 deletions

File tree

src/index.ts

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -485,20 +485,6 @@ export class SqlSimpleParser {
485485
}
486486
return new RegExp("//(.+)/.*/", "//.+/(.*)/");
487487
}
488-
private GetColumnQuantifiers() {
489-
let chars: ColumnQuantifiers = {
490-
Start: '"',
491-
End: '"',
492-
};
493-
if (this.dialect == "mysql") {
494-
chars.Start = "`";
495-
chars.End = "`";
496-
} else if (this.dialect == "sqlserver") {
497-
chars.Start = "[";
498-
chars.End = "]";
499-
}
500-
return chars;
501-
}
502488

503489
private CreatePrimaryKey(
504490
primaryKeyName: string,
@@ -774,7 +760,43 @@ export class SqlSimpleParser {
774760
private static isQuoteChar(char: string): boolean {
775761
return char === '"' || char === "'" || char === "`";
776762
}
777-
763+
/**
764+
* return text quantifiers for dialect
765+
* @returns json
766+
*/
767+
GetColumnQuantifiers() {
768+
let chars: ColumnQuantifiers = {
769+
Start: '"',
770+
End: '"',
771+
};
772+
if (this.dialect == "mysql") {
773+
chars.Start = "`";
774+
chars.End = "`";
775+
} else if (this.dialect == "sqlserver") {
776+
chars.Start = "[";
777+
chars.End = "]";
778+
}
779+
return chars;
780+
}
781+
ToTableList() {
782+
return this.tableList;
783+
}
784+
ToPrimaryKeyList() {
785+
return this.primaryKeyList;
786+
}
787+
ToForeignKeyList() {
788+
return this.foreignKeyList;
789+
}
790+
ResetModel() {
791+
this.tableList = [];
792+
this.primaryKeyList = [];
793+
this.foreignKeyList = [];
794+
return this;
795+
}
796+
/**
797+
* return full sql model
798+
* @returns
799+
*/
778800
ToModel(): DatabaseModel {
779801
return {
780802
TableList: this.tableList,

0 commit comments

Comments
 (0)