Skip to main content
Version: 6.3

sql

Callable

  • sql(sql: readonly string[], ...values: unknown[]): any

  • Alternative to the raw() helper allowing to use it as a tagged template function for the simple cases.

    // as a value
    await em.find(User, { time: sql`now()` });

    // as a key
    await em.find(User, { [sql`lower(name)`]: name.toLowerCase() });

    // value can be empty array
    await em.find(User, { [sql`(select 1 = 1)`]: [] });

    Parameters

    • sql: readonly string[]
    • rest...values: unknown[]

    Returns any

Index

Methods

lower

  • lower<T>(key: string | (alias: string) => string): string
  • Type parameters

    • T: object

    Parameters

    • key: string | (alias: string) => string

      Returns string

    now

    • now(length?: number): string
    • Parameters

      • optionallength: number

      Returns string

    ref

    upper

    • upper<T>(key: string | (alias: string) => string): string
    • Type parameters

      • T: object

      Parameters

      • key: string | (alias: string) => string

        Returns string

      Page Options