Skip to content

FEATURE or QUESTION: how can I write some calculated column? #8747

@cybermerlin

Description

@cybermerlin

What are you doing?

Hi, I need help with this:

select
    birthday, sex,
    concat( lastname, '  ', firstname) as name
from person
where
    name like '%pupi%'

but I try use sequelize like a big trueman:

class Person {
    @Column({type: 'text'})
    firstname;
    @Column({type: 'text'})
    lastname;
    @Column({type: 'datetime'})
    birthday;
    @Column({type: 'tinyint'})
    sex = 1;

    //                           what need I write to do this?
    name;
}

let persona = new Person();
persona.find({name: 'pupi', limit: 1});

console.info(persona.name);

Dialect: any
Dialect version: XXX
Database version: XXX
Sequelize version: XXX
Tested with latest release: No (If yes, specify that version)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions