# Data Transfer Object (DTO) DTOs are classes with a special `@Result` decorator that allow you to separate the module and query results, and you can also use validators and transformers with them. Any class can act as a DTO. It is enough to use `@Result` correctly ```typescript // Module class @Table() @NamedTable('users') class Users extends Module { @AutoIncrementId() public id!: number; @Column({ type: ColumnType.VARCHAR(64) }) public first_name!: string; @Column({ type: ColumnType.VARCHAR(64) }) public last_name!: string; } // DTO class UserDTO { @Result() // If left blank, it will take the name of the field public id!: number; @Result('first_name') public firstName!: string; @Result('last_name') public lastName!: string; } ``` Now you can use it either in Repository as the second argument, or directly in QueryBuilder **Repository example** ```typescript const usersRepository = new Repository(Users, UserDTO); const user : UserDTO | null = await usersRepository.findOne({ first_name: 'Michael' }, { order: { id: 'DESC' } }) ``` **QueryBuilder example** ```typescript const results : UserDTO[] = new QueryBuilder() .setTable(Users) .setType(QueryType.SELECT) .setWhere( new WhereBuilder() .equalAnd("first_name", "Alexey") ) .build() .get(UserDTO) ``` ### [Next >](Validators.md)