Extremely Popular
Go to Latest
interface QueryObjectOptions
implements QueryOptions
import { type QueryObjectOptions } from "https://dotland.deno.dev/x/postgres@v0.19.0/query/query.ts";

Options to control the behavior of a Query instance

Properties

optional
camelCase: boolean

Enabling camel case will transform any snake case field names coming from the database into camel case ones

Ex: SELECT 1 AS my_field will return { myField: 1 }

This won't have any effect if you explicitly set the field names with the fields parameter

optional
fields: string[]

This parameter supersedes query column names coming from the databases in the order they were provided. Fields must be unique and be in the range of (a-zA-Z0-9_), otherwise the query will throw before execution. A field can not start with a number, just like JavaScript variables

This setting overrides the camel case option

Ex: SELECT 'A', 'B' AS my_field with fields ["field_1", "field_2"] will return { field_1: "A", field_2: "B" }