@Module({
controllers: [AppController],
providers: [
Test1Service,
{
provide: 'BLOG',
useValue: new Test2Service('blog'),
},
{
provide: 'ANALYTICS',
useValue: new Test2Service('analytics'),
}
],
})
export class AppModule {}
@Injectable()
export class Test1Service {
constructor(
@Inject('BLOG') public testBlog: Test2Service,
@Inject('ANALYTICS') public testAnalytics: Test2Service
) {}
getIndex() {
this.testBlog.getIndex()
this.testAnalytics.getIndex()
}
}
const query = getConnection()
.createQueryBuilder()
.select('title')
.addSelect(qb => qb
.select('name')
.from(AuthorsEntity, 'aut')
.leftJoin(ArticlesEntity, 'art1', 'aut.id = art1.author_id')
.where('art1.id = art.id'),
'name'
)
.from(ArticlesEntity, 'art');
return query.getRawMany();
SELECT t1.priority, t1.today, COALESCE(t2.yesterday, 0) AS yesterday
FROM
(SELECT priority, COUNT(*) AS 'today' FROM ... WHERE time >= '2021-06-03 00:00:00' AND time <= '2021-06-03 23:59:59' GROUP BY priority) t1
LEFT JOIN
(SELECT priority, COUNT(*) AS 'yesterday' FROM ... WHERE time >= '2021-06-03 00:00:00' AND time <= '2021-06-03 23:59:59' GROUP BY priority) t2
ON (t1.priority = t2.priority);