typeorm#InsertResult TypeScript Examples
The following examples show how to use
typeorm#InsertResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: language.service.ts From bank-server with MIT License | 6 votes |
private async _createLanguage(
name: string,
code: string,
): Promise<InsertResult> {
const queryBuilder = this._languageRepository.createQueryBuilder(
'language',
);
return queryBuilder.insert().values({ name, code }).execute();
}
Example #2
Source File: TypeOrmMediaRepositoryAdapter.ts From typescript-clean-architecture with MIT License | 6 votes |
public async addMedia(media: Media): Promise<{id: string}> {
const ormMedia: TypeOrmMedia = TypeOrmMediaMapper.toOrmEntity(media);
const insertResult: InsertResult = await this
.createQueryBuilder(this.mediaAlias)
.insert()
.into(TypeOrmMedia)
.values([ormMedia])
.execute();
return {
id: insertResult.identifiers[0].id
};
}
Example #3
Source File: TypeOrmPostRepositoryAdapter.ts From typescript-clean-architecture with MIT License | 6 votes |
public async addPost(post: Post): Promise<{id: string}> {
const ormPost: TypeOrmPost = TypeOrmPostMapper.toOrmEntity(post);
const insertResult: InsertResult = await this
.createQueryBuilder(this.postAlias)
.insert()
.into(TypeOrmPost)
.values([ormPost])
.execute();
return {
id: insertResult.identifiers[0].id
};
}
Example #4
Source File: TypeOrmUserRepositoryAdapter.ts From typescript-clean-architecture with MIT License | 6 votes |
public async addUser(user: User): Promise<{id: string}> {
const ormUser: TypeOrmUser = TypeOrmUserMapper.toOrmEntity(user);
const insertResult: InsertResult = await this
.createQueryBuilder(this.userAlias)
.insert()
.into(TypeOrmUser)
.values([ormUser])
.execute();
return {
id: insertResult.identifiers[0].id
};
}
Example #5
Source File: message-key.service.ts From bank-server with MIT License | 5 votes |
private async _createMessageKeys(name: string): Promise<InsertResult> {
const queryBuilder = this._messageKeyRepository.createQueryBuilder(
'messageKey',
);
return queryBuilder.insert().values({ name }).execute();
}