fn: ((fnName, ...args) => Fn)

Type declaration

    • (fnName, ...args): Fn
    • Creates an object representing a database function. This can be used in search queries, both in where and order parts, and as default values in column definitions. If you want to refer to columns in your function, you should use attribute (recommended), identifier, or col (discouraged) otherwise the value will be interpreted as a string.

      ℹ️ This method is usually verbose and we recommend using the sql template string tag instead.

      Parameters

      • fnName: string

        The SQL function you want to call

      • Rest ...args: readonly unknown[]

        All further arguments will be passed as arguments to the function

      Returns Fn

      Example

      Convert a user's username to upper case

      instance.update({
      username: fn('upper', col('username'))
      });

Generated using TypeDoc