diff --git a/site/docs/examples/SELECT/0060-function-calls.js b/site/docs/examples/SELECT/0060-function-calls.js index b6f7e3714..c900ea68a 100644 --- a/site/docs/examples/SELECT/0060-function-calls.js +++ b/site/docs/examples/SELECT/0060-function-calls.js @@ -9,21 +9,29 @@ const result = await db.selectFrom('person') // functions. fn.count('pet.id').as('pet_count'), - // You can call any function by calling \`fn\` directly. - // The arguments are treated as column references by - // default. If you want to pass in values, use the - // \`val\` function. - fn('concat', [val('Ms. '), 'first_name', 'last_name']).as('full_name_with_title'), + // You can call any function by calling \`fn\` + // directly. The arguments are treated as column + // references by default. If you want to pass in + // values, use the \`val\` function. + fn('concat', [ + val('Ms. '), + 'first_name', + 'last_name' + ]).as('full_name_with_title'), // You can call any aggregate function using the // \`fn.agg\` function. fn.agg('array_agg', ['pet.name']).as('pet_names'), - // And once again, you can use the \`sql\` template tag. - // The template tag substitutions are treated as values - // by default. If you want to reference columns, you can - // use the \`ref\` function. - sql\`concat(\${ref('first_name')}, \${ref('last_name')})\`.as('full_name') + // And once again, you can use the \`sql\` + // template tag. The template tag substitutions + // are treated as values by default. If you want + // to reference columns, you can use the \`ref\` + // function. + sql\`concat( + \${ref('first_name')}, + \${ref('last_name')} + )\`.as('full_name') ]) .groupBy('person.id') .having((eb) => eb.fn.count('pet.id'), '>', 10) diff --git a/src/query-builder/function-module.ts b/src/query-builder/function-module.ts index d77faa744..60550f1dc 100644 --- a/src/query-builder/function-module.ts +++ b/src/query-builder/function-module.ts @@ -45,21 +45,29 @@ import { Selectable } from '../util/column-type.js' * // functions. * fn.count('pet.id').as('pet_count'), * - * // You can call any function by calling `fn` directly. - * // The arguments are treated as column references by - * // default. If you want to pass in values, use the - * // `val` function. - * fn('concat', [val('Ms. '), 'first_name', 'last_name']).as('full_name_with_title'), + * // You can call any function by calling `fn` + * // directly. The arguments are treated as column + * // references by default. If you want to pass in + * // values, use the `val` function. + * fn('concat', [ + * val('Ms. '), + * 'first_name', + * 'last_name' + * ]).as('full_name_with_title'), * * // You can call any aggregate function using the * // `fn.agg` function. * fn.agg('array_agg', ['pet.name']).as('pet_names'), * - * // And once again, you can use the `sql` template tag. - * // The template tag substitutions are treated as values - * // by default. If you want to reference columns, you can - * // use the `ref` function. - * sql`concat(${ref('first_name')}, ${ref('last_name')})`.as('full_name') + * // And once again, you can use the `sql` + * // template tag. The template tag substitutions + * // are treated as values by default. If you want + * // to reference columns, you can use the `ref` + * // function. + * sql`concat( + * ${ref('first_name')}, + * ${ref('last_name')} + * )`.as('full_name') * ]) * .groupBy('person.id') * .having((eb) => eb.fn.count('pet.id'), '>', 10)