-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe20e4a
commit 5712552
Showing
48 changed files
with
202 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: Picking subsets of relations with Selector | ||
--- | ||
|
||
For much of the customization, you select sets of relations, or enable particular pieces of code generation for a set of relations. | ||
|
||
In order to make this convenient, there is a `Selector` data type. | ||
|
||
## Pick relations by name or by schema | ||
You can pick relations by expressing with `Selector` what you want: | ||
|
||
```scala mdoc:silent | ||
import typo.* | ||
|
||
val personAndPet0 = Selector.fullRelationNames("myschema.person", "myschemapet") // picks exactly these tables | ||
val personAndPet = Selector.relationNames("person", "pet") // picks these regardless of schema | ||
val mySchema = Selector.schemas("myschema") // picks all relations in schema | ||
|
||
// heaviest syntax, but most flexible | ||
val custom: Selector = relName => relName.schema.exists(_.contains("foo")) && relName.name.contains("bar") | ||
|
||
``` | ||
|
||
### Selectors can be inverted | ||
```scala mdoc:silent | ||
!Selector.schemas("myschema") // matches everything except schema "myschema" | ||
``` | ||
|
||
### Selectors are also composable: | ||
|
||
```scala mdoc:silent | ||
// picks relations which are called `person` or `pet` AND are in the `myschema` schema | ||
personAndPet and mySchema | ||
|
||
// picks those who are *both* called `person` or `pet` OR are in the `myschema` schema. | ||
// This will typically select more relations | ||
personAndPet or mySchema | ||
``` | ||
|
||
The and/or names follows boolean logic, and may actually be a bit counter-intuitive in this particular context. Suggestions welcome to improve naming |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
...enerated-and-checked-in/adventureworks/production/billofmaterials/BillofmaterialsId.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.