Function getModelByTableName

  • Retrieve an Objection model by its table name.

    Parameters

    • tableName: string

      Name of the table to search for.

    • models: Record<string, typeof Model>

      Object containing available models.

    Returns undefined | typeof Model

    The matching model or undefined.

    const User = getModelByTableName("users", allModels);