Skip to content

Commit e45498a

Browse files
authored
Update README.md
1 parent 608bd25 commit e45498a

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,16 +491,27 @@ but also it accept function as value, here's the list of available functions
491491

492492
### Aliases
493493

494-
`FQAlias<OriginalClass>(aliasKey)`
494+
`FQAlias<OriginalClass>(aliasKey)` or `OriginalClass.alias(aliasKey)`
495495

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
497505

498506
So with FQL you can create aliases like this
499507

500508
```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")
504515
```
505516

506517
and you can use KeyPaths of original tables referenced to these aliases like this

0 commit comments

Comments
 (0)