File tree 3 files changed +23
-10
lines changed
3 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ const generateCompositeTypeMarkdown = (
137
137
138
138
const maybeCreateTypeLink = ( type : string , customTypeNames : Set < string > ) => {
139
139
if ( customTypeNames . has ( type ) ) return `[${ type } ](#${ type } )`
140
- const docsUrl = TYPES [ type ]
140
+ const docsUrl = type . match ( / c h a r a c t e r \( \d + \) / ) ? TYPES [ 'character' ] : TYPES [ type ]
141
141
if ( docsUrl ) return `<a href="${ docsUrl } ">${ type } </a>`
142
142
return type
143
143
}
Original file line number Diff line number Diff line change 10
10
"serial" : " https://www.postgresql.org/docs/9.5/datatype-numeric.html" ,
11
11
"bigserial" : " https://www.postgresql.org/docs/9.5/datatype-numeric.html" ,
12
12
"money" : " https://www.postgresql.org/docs/9.5/datatype-money.html" ,
13
- "charachter " : " https://www.postgresql.org/docs/9.5/datatype-character.html" ,
13
+ "character " : " https://www.postgresql.org/docs/9.5/datatype-character.html" ,
14
14
"char" : " https://www.postgresql.org/docs/9.5/datatype-character.html" ,
15
15
"varchar" : " https://www.postgresql.org/docs/9.5/datatype-character.html" ,
16
16
"varyingchar" : " https://www.postgresql.org/docs/9.5/datatype-character.html" ,
Original file line number Diff line number Diff line change @@ -28,16 +28,29 @@ const columnResultDecoder: Decoder<Column[]> = Decoder.array(
28
28
column_default : Decoder . optional ( Decoder . string ) ,
29
29
is_nullable : Decoder . string . map ( ( s ) => s === 'YES' ) ,
30
30
data_type : Decoder . string ,
31
- udt_name : Decoder . string
32
- } ) . map ( ( res ) => ( {
33
- table : res . table_name ,
34
- name : res . column_name ,
35
- default : res . column_default ,
36
- isNullable : res . is_nullable ,
37
- dataType : res . data_type == 'USER-DEFINED' ? res . udt_name : res . data_type ,
38
- } ) )
31
+ udt_name : Decoder . string ,
32
+ character_maximum_length : Decoder . optional ( Decoder . number )
33
+ } ) . map ( ( res ) => {
34
+ return {
35
+ table : res . table_name ,
36
+ name : res . column_name ,
37
+ default : res . column_default ,
38
+ isNullable : res . is_nullable ,
39
+ dataType : get_datatype ( res )
40
+ }
41
+ } )
39
42
)
40
43
44
+ const get_datatype = ( res : { udt_name : string , data_type : string , character_maximum_length : number | undefined } ) => {
45
+ if ( res . data_type == 'USER-DEFINED' ) {
46
+ return res . udt_name
47
+ }
48
+ if ( res . data_type == 'character' && res . character_maximum_length ) {
49
+ return `character (${ res . character_maximum_length } )`
50
+ }
51
+ return res . data_type
52
+ }
53
+
41
54
export type View = {
42
55
name : string
43
56
}
You can’t perform that action at this time.
0 commit comments