Skip to content

Commit b9c55b7

Browse files
Leo5878Leo5878JasonShin
authored
[style] Clean up semicolons after interface blocks (#209)
* Clean up semicolons after interface blocks * refactor tests * cleanup mysql * cleanup tests * fix test * regen sample.queries.ts --------- Co-authored-by: Leo5878 <[email protected]> Co-authored-by: JasonShin <[email protected]>
1 parent eed8406 commit b9c55b7

File tree

91 files changed

+667
-676
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+667
-676
lines changed

src/ts_generator/types/ts_query.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ impl fmt::Display for TsQuery {
389389

390390
let params = format!("export type {name}Params = [{params_str}];");
391391

392-
let result = format!("export interface I{name}Result {{\n\t{result_str}\n}};");
392+
let result = format!("export interface I{name}Result {{\n\t{result_str}\n}}");
393393

394-
let query = format!("export interface I{name}Query {{\n\tparams: {name}Params;\n\tresult: I{name}Result;\n}};");
394+
let query = format!("export interface I{name}Query {{\n\tparams: {name}Params;\n\tresult: I{name}Result;\n}}");
395395

396396
let final_code = format!("{params}\n\n{result}\n\n{query}");
397397

tests/column_naming_convention.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ export type SomeQueryParams = [];
3434
export interface ISomeQueryResult {
3535
helloWorld: number;
3636
name: string;
37-
};
37+
}
3838
3939
export interface ISomeQueryQuery {
4040
params: SomeQueryParams;
4141
result: ISomeQueryResult;
42-
};
42+
}
43+
4344
"#
4445
);
4546

@@ -65,12 +66,12 @@ export interface ISomeQueryResult {
6566
HelloWorld1: number;
6667
HelloWorld2: number;
6768
Name: string;
68-
};
69+
}
6970
7071
export interface ISomeQueryQuery {
7172
params: SomeQueryParams;
7273
result: ISomeQueryResult;
73-
};
74+
}
7475
"#
7576
);
7677

@@ -96,12 +97,12 @@ export interface ISomeQueryResult {
9697
HelloWorld1: number;
9798
HelloWorld2: number;
9899
Name: string;
99-
};
100+
}
100101
101102
export interface ISomeQueryQuery {
102103
params: SomeQueryParams;
103104
result: ISomeQueryResult;
104-
};
105+
}
105106
"#
106107
);
107108
}

tests/covert_to_camelcase.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ export interface ISomeQueryResult {
3535
HelloWorld: number;
3636
hello_world: number;
3737
inventory_id: number | null;
38-
};
38+
}
3939
4040
export interface ISomeQueryQuery {
4141
params: SomeQueryParams;
4242
result: ISomeQueryResult;
43-
};
43+
}
4444
"#
4545
);
4646

@@ -66,12 +66,12 @@ export interface ISomeQueryResult {
6666
helloWorld1: number;
6767
helloWorld2: number;
6868
inventoryId: number | null;
69-
};
69+
}
7070
7171
export interface ISomeQueryQuery {
7272
params: SomeQueryParams;
7373
result: ISomeQueryResult;
74-
};
74+
}
7575
"#
7676
);
7777

@@ -97,12 +97,12 @@ export interface ISomeQueryResult {
9797
HelloWorld1: number;
9898
hello_world2: number;
9999
inventory_id: number | null;
100-
};
100+
}
101101
102102
export interface ISomeQueryQuery {
103103
params: SomeQueryParams;
104104
result: ISomeQueryResult;
105-
};
105+
}
106106
"#
107107
);
108108
}

tests/demo/alias/alias.queries.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,75 @@ export type Sql1Params = [];
22

33
export interface ISql1Result {
44
id1: number;
5-
};
5+
}
66

77
export interface ISql1Query {
88
params: Sql1Params;
99
result: ISql1Result;
10-
};
10+
}
1111

1212
export type Sql2Params = [];
1313

1414
export interface ISql2Result {
1515
id2: number;
16-
};
16+
}
1717

1818
export interface ISql2Query {
1919
params: Sql2Params;
2020
result: ISql2Result;
21-
};
21+
}
2222

2323
export type Sql3Params = [];
2424

2525
export interface ISql3Result {
2626
itemsId: number;
27-
};
27+
}
2828

2929
export interface ISql3Query {
3030
params: Sql3Params;
3131
result: ISql3Result;
32-
};
32+
}
3333

3434
export type Sql4Params = [];
3535

3636
export interface ISql4Result {
3737
theCount: number;
38-
};
38+
}
3939

4040
export interface ISql4Query {
4141
params: Sql4Params;
4242
result: ISql4Result;
43-
};
43+
}
4444

4545
export type Sql5Params = [];
4646

4747
export interface ISql5Result {
4848
theAvg: number;
49-
};
49+
}
5050

5151
export interface ISql5Query {
5252
params: Sql5Params;
5353
result: ISql5Result;
54-
};
54+
}
5555

5656
export type Sql6Params = [];
5757

5858
export interface ISql6Result {
5959
lowerVarchar: string;
60-
};
60+
}
6161

6262
export interface ISql6Query {
6363
params: Sql6Params;
6464
result: ISql6Result;
65-
};
65+
}
6666

6767
export type Sql7Params = [];
6868

6969
export interface ISql7Result {
7070
currentTime: string;
71-
};
71+
}
7272

7373
export interface ISql7Query {
7474
params: Sql7Params;
7575
result: ISql7Result;
76-
};
76+
}

tests/demo/alias/alias.snapshot.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,76 @@ export type Sql1Params = [];
22

33
export interface ISql1Result {
44
id1: number;
5-
};
5+
}
66

77
export interface ISql1Query {
88
params: Sql1Params;
99
result: ISql1Result;
10-
};
10+
}
1111

1212
export type Sql2Params = [];
1313

1414
export interface ISql2Result {
1515
id2: number;
16-
};
16+
}
1717

1818
export interface ISql2Query {
1919
params: Sql2Params;
2020
result: ISql2Result;
21-
};
21+
}
2222

2323
export type Sql3Params = [];
2424

2525
export interface ISql3Result {
2626
itemsId: number;
27-
};
27+
}
2828

2929
export interface ISql3Query {
3030
params: Sql3Params;
3131
result: ISql3Result;
32-
};
32+
}
3333

3434
export type Sql4Params = [];
3535

3636
export interface ISql4Result {
3737
theCount: number;
38-
};
38+
}
3939

4040
export interface ISql4Query {
4141
params: Sql4Params;
4242
result: ISql4Result;
43-
};
43+
}
4444

4545
export type Sql5Params = [];
4646

4747
export interface ISql5Result {
4848
theAvg: number;
49-
};
49+
}
5050

5151
export interface ISql5Query {
5252
params: Sql5Params;
5353
result: ISql5Result;
54-
};
54+
}
5555

5656
export type Sql6Params = [];
5757

5858
export interface ISql6Result {
5959
lowerVarchar: string;
60-
};
60+
}
6161

6262
export interface ISql6Query {
6363
params: Sql6Params;
6464
result: ISql6Result;
65-
};
65+
}
6666

6767
export type Sql7Params = [];
6868

6969
export interface ISql7Result {
7070
currentTime: string;
71-
};
71+
}
7272

7373
export interface ISql7Query {
7474
params: Sql7Params;
7575
result: ISql7Result;
76-
};
76+
}
7777

tests/demo/annotations/annotations.queries.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ export interface ITestMysqlQueryResult {
66
inventory_id: number | null;
77
name: string;
88
rarity: string | null;
9-
};
9+
}
1010

1111
export interface ITestMysqlQueryQuery {
1212
params: TestMysqlQueryParams;
1313
result: ITestMysqlQueryResult;
14-
};
14+
}
1515

1616
export type TestPostgresQueryParams = [];
1717

@@ -21,55 +21,55 @@ export interface ITestPostgresQueryResult {
2121
inventory_id: number | null;
2222
name: string;
2323
rarity: string | null;
24-
};
24+
}
2525

2626
export interface ITestPostgresQueryQuery {
2727
params: TestPostgresQueryParams;
2828
result: ITestPostgresQueryResult;
29-
};
29+
}
3030

3131
export type AnnotationSql3Params = [];
3232

3333
export interface IAnnotationSql3Result {
3434
id: string;
35-
};
35+
}
3636

3737
export interface IAnnotationSql3Query {
3838
params: AnnotationSql3Params;
3939
result: IAnnotationSql3Result;
40-
};
40+
}
4141

4242
export type AnnotationSql4Params = [string | null];
4343

4444
export interface IAnnotationSql4Result {
4545
character_id: number | null;
4646
id: number;
4747
quantity: number | null;
48-
};
48+
}
4949

5050
export interface IAnnotationSql4Query {
5151
params: AnnotationSql4Params;
5252
result: IAnnotationSql4Result;
53-
};
53+
}
5454

5555
export type AnnotationSql5Params = [string];
5656

5757
export interface IAnnotationSql5Result {
5858
inventoryId: boolean;
59-
};
59+
}
6060

6161
export interface IAnnotationSql5Query {
6262
params: AnnotationSql5Params;
6363
result: IAnnotationSql5Result;
64-
};
64+
}
6565

6666
export type TestMysqlQueryWithParamOverridesParams = [string];
6767

6868
export interface ITestMysqlQueryWithParamOverridesResult {
6969
inventoryId: number;
70-
};
70+
}
7171

7272
export interface ITestMysqlQueryWithParamOverridesQuery {
7373
params: TestMysqlQueryWithParamOverridesParams;
7474
result: ITestMysqlQueryWithParamOverridesResult;
75-
};
75+
}

0 commit comments

Comments
 (0)