diff --git a/packages/repository/src/repositories/repository.ts b/packages/repository/src/repositories/repository.ts index 8bb1464e2a1d..115eaf49addd 100644 --- a/packages/repository/src/repositories/repository.ts +++ b/packages/repository/src/repositories/repository.ts @@ -26,7 +26,37 @@ export interface Repository {} export interface ExecutableRepository extends Repository { /** - * Execute a query with the given parameter object or an array of parameters + * Proxy method for the underlying connector's method to execute raw queries. + * Support and method signature are entirely dependent on the underlying + * connector's implementation. The result object is the connector's native + * result object, you will have to process it on your own. + * + * @remarks + * + * MySQL usage example: + * + * Although the whole command can be specified in the `command` argument. It + * is recommended to specify the parameters in the `parameters` argument, + * which is an array in case of MySQL. + * + *```ts + * myRepository.execute( + * 'SELECT * from User WHERE name=? && status=?', + * ['John', 'active'] + *); + *``` + * + * Using `parameters` argument helps to prevent SQL injection attacks. + * + * MongoDB usage example: + * + * In case of MongoDB, the first parameter is the collection name, the second + * parameter is the command name, and the third being the options. + * + * const res = await myRepository.execute( + * 'Pet', 'find', {type:'cat'} + * ); + * * @param command - The query string or command object * @param parameters - The object with name/value pairs or an array of parameter * values