You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -491,16 +491,27 @@ but also it accept function as value, here's the list of available functions
491
491
492
492
### Aliases
493
493
494
-
`FQAlias<OriginalClass>(aliasKey)`
494
+
`FQAlias<OriginalClass>(aliasKey)` or `OriginalClass.alias(aliasKey)`
495
495
496
-
When you write complex query you can several joins or subqueries to the same table and you need to use aliases for that like `"Cars" as c`
496
+
Also you can use static alias `OriginalClass.alias` if you need only one its variation
497
+
498
+
And you can generate random alias `OriginalClass.randomAlias` but keep in mind that every call to `randomAlias` generates new alias as it's computed property
499
+
500
+
#### What's that for?
501
+
502
+
When you write complex query you may have several joins or subqueries to the same table and you need to use aliases for that like `"Cars" as c`
503
+
504
+
#### Usage
497
505
498
506
So with FQL you can create aliases like this
499
507
500
508
```swift
501
-
let aliasBrand = FQAlias<Brand>("b")
502
-
let aliasModel = FQAlias<Model>("m")
503
-
let aliasEngineType = FQAlias<EngineType>("e")
509
+
//"CarBrand" as b
510
+
let aliasBrand = CarBrand.alias("b")
511
+
//"CarModel" as m
512
+
let aliasModel = CarModel.alias("m")
513
+
//"EngineType" as e
514
+
let aliasEngineType = EngineType.alias("e")
504
515
```
505
516
506
517
and you can use KeyPaths of original tables referenced to these aliases like this
0 commit comments