Skip to content

Commit d09fb89

Browse files
committed
change explain() default format from json to text
1 parent d50e2cd commit d09fb89

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/PostgrestTransformBuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ export default class PostgrestTransformBuilder<
156156
* @param settings If `true`, include information on configuration parameters that affect query planning.
157157
* @param buffers If `true`, include information on buffer usage.
158158
* @param wal If `true`, include information on WAL record generation
159-
* @param format The format of the output, can be 'json'(default) or 'text'
159+
* @param format The format of the output, can be 'text'(default) or `json`
160160
*/
161161
explain({
162162
analyze = false,
163163
verbose = false,
164164
settings = false,
165165
buffers = false,
166166
wal = false,
167-
format = 'json',
167+
format = 'text',
168168
}: {
169169
analyze?: boolean
170170
verbose?: boolean

test/transforms.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ test('abort signal', async () => {
103103
// })
104104

105105
test('explain with json/text format', async () => {
106-
const res1 = await postgrest.from('users').select().explain()
106+
const res1 = await postgrest.from('users').select().explain({format: 'json'})
107107
expect(res1).toMatchInlineSnapshot(`
108108
Object {
109109
"count": undefined,
@@ -142,7 +142,7 @@ test('explain with json/text format', async () => {
142142
}
143143
`)
144144

145-
const res2 = await postgrest.from('users').select().explain({ format: 'text' })
145+
const res2 = await postgrest.from('users').select().explain()
146146
expect(res2.data).toMatch(
147147
`Aggregate (cost=17.65..17.68 rows=1 width=112)
148148
-> Seq Scan on users (cost=0.00..15.10 rows=510 width=132)
@@ -151,7 +151,7 @@ test('explain with json/text format', async () => {
151151
})
152152

153153
test('explain with options', async () => {
154-
const res = await postgrest.from('users').select().explain({ verbose: true, settings: true })
154+
const res = await postgrest.from('users').select().explain({ verbose: true, settings: true, format: 'json' })
155155
expect(res).toMatchInlineSnapshot(`
156156
Object {
157157
"count": undefined,

0 commit comments

Comments
 (0)