This is how I have defined my repository following very generic example given at loopback documentation:-
import {DefaultCrudRepository, juggler} from '@loopback/repository';
import {AModel} from '../models';
import {TimeseriesDataSource} from '../datasources';
import {inject} from '@loopback/core';
export class AModelRepository extends DefaultCrudRepository<
AModel,
typeof AModel.prototype.id
> {
constructor(
@inject('datasources.timeseries') dataSource: TimeseriesDataSource,
) {
super(AModel, dataSource);
}
}
I was hoping that if do AModelRepository.execute(sql, null, cb)
it would work. But its giving error - Error: Not implemented
Any help is highly appreciated.
Somehow I got it working by injecting the datasource like this
I will edit if I find any better approach. Please feel free to correct this answer.