File tree Expand file tree Collapse file tree 2 files changed +158
-0
lines changed Expand file tree Collapse file tree 2 files changed +158
-0
lines changed Original file line number Diff line number Diff line change @@ -93,3 +93,83 @@ test('list without columns', async () => {
9393 `
9494 )
9595} )
96+
97+ test ( 'retrieve' , async ( ) => {
98+ const res = await pgMeta . foreignTables . retrieve ( { schema : 'public' , name : 'foreign_table' } )
99+ expect ( res ) . toMatchInlineSnapshot (
100+ { data : { id : expect . any ( Number ) } } ,
101+ `
102+ {
103+ "data": {
104+ "columns": [
105+ {
106+ "comment": null,
107+ "data_type": "bigint",
108+ "default_value": null,
109+ "enums": [],
110+ "format": "int8",
111+ "id": "16434.1",
112+ "identity_generation": null,
113+ "is_generated": false,
114+ "is_identity": false,
115+ "is_nullable": true,
116+ "is_unique": false,
117+ "is_updatable": true,
118+ "name": "id",
119+ "ordinal_position": 1,
120+ "schema": "public",
121+ "table": "foreign_table",
122+ "table_id": 16434,
123+ },
124+ {
125+ "comment": null,
126+ "data_type": "text",
127+ "default_value": null,
128+ "enums": [],
129+ "format": "text",
130+ "id": "16434.2",
131+ "identity_generation": null,
132+ "is_generated": false,
133+ "is_identity": false,
134+ "is_nullable": true,
135+ "is_unique": false,
136+ "is_updatable": true,
137+ "name": "name",
138+ "ordinal_position": 2,
139+ "schema": "public",
140+ "table": "foreign_table",
141+ "table_id": 16434,
142+ },
143+ {
144+ "comment": null,
145+ "data_type": "USER-DEFINED",
146+ "default_value": null,
147+ "enums": [
148+ "ACTIVE",
149+ "INACTIVE",
150+ ],
151+ "format": "user_status",
152+ "id": "16434.3",
153+ "identity_generation": null,
154+ "is_generated": false,
155+ "is_identity": false,
156+ "is_nullable": true,
157+ "is_unique": false,
158+ "is_updatable": true,
159+ "name": "status",
160+ "ordinal_position": 3,
161+ "schema": "public",
162+ "table": "foreign_table",
163+ "table_id": 16434,
164+ },
165+ ],
166+ "comment": null,
167+ "id": Any<Number>,
168+ "name": "foreign_table",
169+ "schema": "public",
170+ },
171+ "error": null,
172+ }
173+ `
174+ )
175+ } )
Original file line number Diff line number Diff line change @@ -92,3 +92,81 @@ test('list without columns', async () => {
9292 `
9393 )
9494} )
95+
96+ test ( 'retrieve' , async ( ) => {
97+ const res = await pgMeta . views . retrieve ( { schema : 'public' , name : 'todos_view' } )
98+ expect ( res ) . toMatchInlineSnapshot (
99+ { data : { id : expect . any ( Number ) } } ,
100+ `
101+ {
102+ "data": {
103+ "columns": [
104+ {
105+ "comment": null,
106+ "data_type": "bigint",
107+ "default_value": null,
108+ "enums": [],
109+ "format": "int8",
110+ "id": "16420.1",
111+ "identity_generation": null,
112+ "is_generated": false,
113+ "is_identity": false,
114+ "is_nullable": true,
115+ "is_unique": false,
116+ "is_updatable": true,
117+ "name": "id",
118+ "ordinal_position": 1,
119+ "schema": "public",
120+ "table": "todos_view",
121+ "table_id": 16420,
122+ },
123+ {
124+ "comment": null,
125+ "data_type": "text",
126+ "default_value": null,
127+ "enums": [],
128+ "format": "text",
129+ "id": "16420.2",
130+ "identity_generation": null,
131+ "is_generated": false,
132+ "is_identity": false,
133+ "is_nullable": true,
134+ "is_unique": false,
135+ "is_updatable": true,
136+ "name": "details",
137+ "ordinal_position": 2,
138+ "schema": "public",
139+ "table": "todos_view",
140+ "table_id": 16420,
141+ },
142+ {
143+ "comment": null,
144+ "data_type": "bigint",
145+ "default_value": null,
146+ "enums": [],
147+ "format": "int8",
148+ "id": "16420.3",
149+ "identity_generation": null,
150+ "is_generated": false,
151+ "is_identity": false,
152+ "is_nullable": true,
153+ "is_unique": false,
154+ "is_updatable": true,
155+ "name": "user-id",
156+ "ordinal_position": 3,
157+ "schema": "public",
158+ "table": "todos_view",
159+ "table_id": 16420,
160+ },
161+ ],
162+ "comment": null,
163+ "id": Any<Number>,
164+ "is_updatable": true,
165+ "name": "todos_view",
166+ "schema": "public",
167+ },
168+ "error": null,
169+ }
170+ `
171+ )
172+ } )
You can’t perform that action at this time.
0 commit comments