Skip to content

Commit 1da067b

Browse files
authored
Spelling/Grammar
1 parent 58547ad commit 1da067b

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

Diff for: CODEGEN.md

+18-19
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Quill Code Generator
22

3-
This library is designed to give you a few options as to what kind of
4-
schema to generate from JDBC metadata for quill. You can choose to generate
5-
either simple case classes or a combination of case classes and query schemas,
6-
as well as whether they should written to one file, multiple files, or
7-
just a list of strings (useful for streaming directly into a repl).
8-
Inspired by the Slick code generator albeit a bit simpler,
9-
the code generator is fairly customizeable and a couple of
10-
ready-to-use implementations come out of the box.
3+
This library gives you a few options as to what kind of
4+
schema to generate from JDBC metadata for Quill. You can choose to generate
5+
simple case classes that are controlled entirely but a Quill Naming Strategy,
6+
or a combination of case classes and `querySchema`s.
7+
You can also choose whether they should written to one file, multiple files, or
8+
just a list of strings (useful for executing directly into a repl).
9+
Thanks to the Slick code generator creators for providing inspiration for this library!
1110

1211
Currently the code generator is only available for JDBC databases but it will
1312
be extended in the future for Cassandra as well as others.
@@ -29,11 +28,11 @@ libraryDependencies += "io.getquill" %% "quill-codegen-jdbc" % "3.1.1-SNAPSHOT"
2928

3029
## SimpleJdbcCodegen
3130

32-
This code generator is to generates simple case classes representing tables
31+
This code generator generates simple case classes, each representing a table
3332
in a database. It does not generate Quill `querySchema` objects.
3433
Create one or multiple CodeGeneratorConfig objects
3534
and call the `.writeFiles` or `.writeStrings` methods
36-
on the code generator and the rest happens automatically.
35+
on the code generator to generate the code.
3736

3837
Given the following schema:
3938
````sql
@@ -64,8 +63,7 @@ gen.writeFiles("src/main/scala/com/my/project")
6463
````
6564

6665
You can parse column and table names using either the `SnakeCaseNames` or the and the `LiteralNames` parser
67-
which are used with the respective Quill Naming Strategies. (For more complex naming rules, use the `ComposeableTraitsJdbcCodegen`
68-
in order to generate `querySchema` object which can have fully customized column/table names).
66+
which are used with the respective Quill Naming Strategies. They cannot be customized further with this code generator.
6967

7068
The following case case classes will be generated
7169
````scala
@@ -83,14 +81,15 @@ case class Address(personFk: Int, street: Option[String], zip: Option[Int])
8381
````
8482

8583

86-
If you wish to generate schemas with custom table or column names, you need to use the ComposeableTraitsGen
87-
in order to generate your schemas.
84+
If you wish to generate schemas with custom table or column names, you need to use the `ComposeableTraitsJdbcCodegen`
85+
in order to generate your schemas with `querySchema` objects.
8886

8987
## Composeable Traits Codegen
9088

9189
The `ComposeableTraitsJdbcCodegen` allows you to customize table/column names in entity case classes
92-
and generates the necessary `querySchema` object in order to map them. Additionally, it generates a
93-
database-independent query schema trait which can be composed with a `Context` object of your choice.
90+
and generates the necessary `querySchema` object in order to map the fields.
91+
Additionally, it generates a database-independent query schema trait which can be composed
92+
with a `Context` object of your choice.
9493

9594
Given the following schema:
9695
````sql
@@ -168,8 +167,8 @@ object MyCustomContext extends SqlMirrorContext[H2Dialect, Literal](H2Dialect, L
168167

169168
## Stereotyping
170169
Frequently in corporate databases, the same kind of table is duplicated across multiple schemas, databases, etc...
171-
for different business units. Typically, all the duplicates of the table will have almost the same columns
172-
with only minor differences. Stereotyped code-generation aims to take the 'lowest common denominator' of all these schemas
170+
for different business units. Typically, all the duplicates of the table will have nearly the same columns
171+
with just minor differences. Stereotyped code-generation aims to take the 'lowest common denominator' of all these schemas
173172
in order to produce a case class that can be used across all of them.
174173

175174
Examine the following H2 DDL:
@@ -266,4 +265,4 @@ the `CommonExtensions` like so:
266265
````scala
267266
object MyCustomContext extends SqlMirrorContext[H2Dialect, Literal](H2Dialect, Literal)
268267
with CommonExtensions[H2Dialect, Literal]
269-
````
268+
````

0 commit comments

Comments
 (0)