typeorm-extensions 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,20 +25,26 @@ npm install typeorm-extensions
25
25
  ## Usage
26
26
 
27
27
  ```typescript
28
- import { createQueryBuilder } from 'typeorm';
29
28
  import 'typeorm-extensions'; // Import the library root to extend the QueryBuilder with all extensions
30
29
 
31
30
  // Or init specific extension: import from 'typeorm-extensions/dist/extensions/pagination.extension';
32
31
 
33
- const query = createQueryBuilder()
34
- .from(User, 'user')
32
+ const query = myDataSource
33
+ .createQueryBuilder()
34
+ .from(UserEntity, 'users')
35
+ // Join relation defined in entity model
36
+ .leftJoinTyped(user => users.profile, 'profile')
37
+ // Select type-safe properties
35
38
  .selectTyped(user => ([
36
39
  id: user.id,
37
40
  name: user.name,
38
41
  email: user.email,
39
42
  ]))
40
- .orderTyped(user => user.createdAt, 'ASC')
41
- .applyPagination({ page: 1, pageSize: 10 });
43
+ .whereTyped(user => user.name, 'ILIKE :search', { search: 'John' })
44
+ // Order by type-safe own and relation properties
45
+ .orderByTyped(user => user.profile.avatarUrl, 'ASC', 'NULLS LAST')
46
+ // Use pagination as simple as that
47
+ .applyPaginationFilter({ page: 1, pageSize: 10 }, { useTakeAndSkip: true });
42
48
  ```
43
49
 
44
50
  ## Documentation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typeorm-extensions",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "typeorm commonly used extensions",
5
5
  "main": "./dist/index.js",
6
6
  "repository": {
@@ -1,8 +1,8 @@
1
1
  export const defaultPageSize = 10;
2
2
 
3
- export const defaultUseTakeAndSkip = true;
3
+ export const defaultUseTakeAndSkip = false;
4
4
 
5
- export const defaultUseDoubleQuotes = false;
5
+ export const defaultUseDoubleQuotes = true;
6
6
 
7
7
  export const defaultOrderDirection = 'ASC';
8
8