Skip to content

Add Sequelize.attr #13773

Closed
Closed

Description

@ephys

I've completely dropped the previous RFC. See edits if you're interested in its history.

Here is the new draft:

Sequelize.attr

Like Sequelize.col but where Sequelize.col is used to reference a column name, Sequelize.attr is used to reference an attribute name.

Because sometimes you need to be able to reference another attribute, and having to specify that other attribute's column name instead is inconsistent as column names are abstracted away almost everywhere else.

// instead of having to write
User.findOne({
  where: {
    birthDate: { [Op.gt]: Sequelize.col('register_date') },
  },
})

// you'd write

User.findOne({
  where: {
    birthDate: { [Op.gt]: Sequelize.attr('registerDate') },
  },
})

Sequelize.attr would follow the same syntax as plain attribute references. Meaning it would support:

  • Sequelize.attr('$association.value$')
  • Sequelize.attr('json.path')

Activity

  1. added
    breaking change
    type: feature
    on Dec 14, 2021
  2. ephys commented on Dec 15, 2021

    @ephys
    Author
  3. fzn0x commented on Dec 15, 2021

    @fzn0x
  4. ephys commented on Dec 15, 2021

    @ephys
    Author
  5. fzn0x commented on Dec 15, 2021

    @fzn0x
  6. changed the title [-]RFC: [V7] Changes to `Sequelize.col`[/-] [+][RFC] Add `Sequelize.attr`, `Model.attr`[/+] on Dec 23, 2021
  7. ephys commented on Dec 23, 2021

    @ephys
    Author
  8. self-assigned this
    on Dec 23, 2021
  9. changed the title [-][RFC] Add `Sequelize.attr`, `Model.attr`[/-] [+][RFC] Add `Sequelize.attr`[/+] on Jan 25, 2022
  10. removed
    breaking change
    on Jan 26, 2022
  11. added
    RFC
    and removed
    type: feature
    on Mar 30, 2022
  12. changed the title [-][RFC] Add `Sequelize.attr`[/-] [+]Add `Sequelize.attr`[/+] on Dec 20, 2022
  13. added
    type: feature
    and removed
    RFC
    on Dec 20, 2022
  14. moved this to Doing (v7) in Roadmapon Mar 10, 2023
  15. moved this from Doing (v7) to Done in Roadmapon Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: feature

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions