prorm API Reference
    Preparing search index...

    Function conv

    • Create a CONVERT expression for type conversion SQL: CONVERT(value, type) for MySQL, or CAST for other dialects

      Parameters

      • value: any
      • from: string | null | undefined
      • to: string

      Returns ConvExpression

      // CONVERT(value, to_type)
      User.findAll({
      attributes: [[conv(col('value'), null, 'CHAR'), 'strValue']]
      })

      // CONVERT with charset (MySQL)
      conv(col('name'), null, 'CHAR(255) CHARACTER SET utf8mb4')

      // Base type conversion
      conv(col('text'), 'CHAR', 'INTEGER')