Skip to content

Commit

Permalink
feat: add a @InjectRedisClient decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
bassochette committed Mar 11, 2022
1 parent ff68c52 commit 1c05bfa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ This package is globally providing `REDIS_CLIENT`

```ts
import { Injectable } from '@nestjs/common';
import { REDIS_CLIENT, RedisClient } from '@webeleon/nestjs-redis';
import { InjectRedisClient, RedisClient } from '@webeleon/nestjs-redis';

@Injectable()
export class SomeService {
constructor(
@Inject(REDIS_CLIENT) redisClient: RedisClient
@InjectRedisClient() redisClient: RedisClient
) {}
}
```
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./redis/redis.module";
export * from "./redis/redis.client";
export * from "./redis/redis.decorator";
4 changes: 4 additions & 0 deletions src/redis/redis.decorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Inject } from "@nestjs/common";
import { REDIS_CLIENT } from "./redis.client";

export const InjectRedisClient = () => Inject(REDIS_CLIENT);

0 comments on commit 1c05bfa

Please sign in to comment.