Skip to content
This repository was archived by the owner on Oct 24, 2020. It is now read-only.

Commit 7d49eef

Browse files
committed
Update documentation
1 parent ad6134c commit 7d49eef

File tree

2 files changed

+158
-46
lines changed

2 files changed

+158
-46
lines changed

README.md

Lines changed: 70 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ Quarkus Extension for Doma
55

66
Quarkus Extension for Doma provides the following features:
77

8-
- Hot reload
8+
- Hot reloading
99
- Automatic bean register
1010
- Automatic SQL execution on startup
1111
- Configuration
12+
- Multiple Datasources
1213
- Support for native images
1314

14-
### Hot reload
15+
### Hot reloading
1516

1617
In development mode, SQL and Script files are hot reloaded.
1718

@@ -28,17 +29,15 @@ Our extension executes ``import.sql`` automatically when Doma starts.
2829
You can write the following configurations in your application.properties file:
2930

3031
```
31-
quarkus.doma.datasource-name=default
32-
quarkus.doma.dialect=h2
3332
quarkus.doma.sql-file-repository=greedy-cache
3433
quarkus.doma.naming=none
3534
quarkus.doma.exception-sql-log-type=none
36-
quarkus.doma.batch-size=0
37-
quarkus.doma.fetch-size=0
38-
quarkus.doma.max-rows=0
39-
quarkus.doma.query-timeout=0
35+
quarkus.doma.dialect=h2
36+
quarkus.doma.batch-size=10
37+
quarkus.doma.fetch-size=50
38+
quarkus.doma.max-rows=500
39+
quarkus.doma.query-timeout=5000
4040
quarkus.doma.sql-load-script=import.sql
41-
4241
quarkus.doma.log.sql=false
4342
quarkus.doma.log.dao=false
4443
quarkus.doma.log.closing-failure=false
@@ -48,6 +47,68 @@ The above properties are all optional.
4847

4948
See [quarkus-doma.adoc](./quarkus-doma.adoc) for more details.
5049

50+
### Multiple Datasources
51+
52+
You can bind Doma's configurations to each datasource as follows:
53+
54+
```
55+
# default datasource
56+
quarkus.datasource.db-kind=h2
57+
quarkus.datasource.username=username-default
58+
quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:default
59+
quarkus.datasource.jdbc.min-size=3
60+
quarkus.datasource.jdbc.max-size=13
61+
62+
# inventory datasource
63+
quarkus.datasource.inventory.db-kind=h2
64+
quarkus.datasource.inventory.username=username2
65+
quarkus.datasource.inventory.jdbc.url=jdbc:h2:tcp://localhost/mem:inventory
66+
quarkus.datasource.inventory.jdbc.min-size=2
67+
quarkus.datasource.inventory.jdbc.max-size=12
68+
69+
# Doma's configuration bound to the above default datasource
70+
quarkus.doma.dialect=h2
71+
quarkus.doma.batch-size=10
72+
quarkus.doma.fetch-size=50
73+
quarkus.doma.max-rows=500
74+
quarkus.doma.query-timeout=5000
75+
quarkus.doma.sql-load-script=import.sql
76+
77+
# Doma's configuration bound to the above inventory datasource
78+
quarkus.doma.inventory.dialect=h2
79+
quarkus.doma.inventory.batch-size=10
80+
quarkus.doma.inventory.fetch-size=50
81+
quarkus.doma.inventory.max-rows=500
82+
quarkus.doma.inventory.query-timeout=5000
83+
quarkus.doma.inventory.sql-load-script=import.sql
84+
```
85+
86+
You can inject the named Doma's resource
87+
using the `io.quarkus.agroal.DataSource` qualifier as follows:
88+
89+
```java
90+
@Inejct
91+
Config defaultConfig;
92+
93+
@Inejct
94+
Entityql defaultEntityql;
95+
96+
@Inejct
97+
Nativeql defaultNativeql;
98+
99+
@Inejct
100+
@DataSource("inventory")
101+
Config invetoryConfig;
102+
103+
@Inejct
104+
@DataSource("inventory")
105+
Entityql inventoryEntityql;
106+
107+
@Inejct
108+
@DataSource("inventory")
109+
Nativeql inventoryNativeql;
110+
```
111+
51112
### Support for native images
52113

53114
Our extension recognizes reflective classes and resources,

quarkus-doma.adoc

Lines changed: 88 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,56 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.dialect]]`lin
1313
[.description]
1414
--
1515
The SQL dialect.
16-
--|`standard`, `mssql`, `mysql`, `postgres`, `h2`
16+
--|`db2`, `h2`, `mssql`, `mysql`, `oracle`, `postgres`, `standard`, `sqlite`
1717
|`depends on 'quarkus.datasource.db-kind'`
1818

1919

20+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.batch-size]]`link:#quarkus-doma_quarkus.doma.batch-size[quarkus.doma.batch-size]`
21+
22+
[.description]
23+
--
24+
The batch size.
25+
--|int
26+
|`0`
27+
28+
29+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.fetch-size]]`link:#quarkus-doma_quarkus.doma.fetch-size[quarkus.doma.fetch-size]`
30+
31+
[.description]
32+
--
33+
The fetch size.
34+
--|int
35+
|`0`
36+
37+
38+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.max-rows]]`link:#quarkus-doma_quarkus.doma.max-rows[quarkus.doma.max-rows]`
39+
40+
[.description]
41+
--
42+
The max rows.
43+
--|int
44+
|`0`
45+
46+
47+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.query-timeout]]`link:#quarkus-doma_quarkus.doma.query-timeout[quarkus.doma.query-timeout]`
48+
49+
[.description]
50+
--
51+
The query timeout limit in seconds.
52+
--|int
53+
|`0`
54+
55+
56+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.sql-load-script]]`link:#quarkus-doma_quarkus.doma.sql-load-script[quarkus.doma.sql-load-script]`
57+
58+
[.description]
59+
--
60+
Name of the file containing the SQL statements to execute when Doma starts. Its default value differs depending on the Quarkus launch mode:
61+
* In dev and test modes, it defaults to `import.sql`. Simply add an `import.sql` file in the root of your resources directory and it will be picked up without having to set this property. Pass `no-file` to force Doma to ignore the SQL import file. * In production mode, it defaults to `no-file`. It means Doma won't try to execute any SQL import file by default. Pass an explicit value to force Doma to execute the SQL import file.
62+
--|string
63+
|`import.sql in DEV, TEST ; no-file otherwise`
64+
65+
2066
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.sql-file-repository]]`link:#quarkus-doma_quarkus.doma.sql-file-repository[quarkus.doma.sql-file-repository]`
2167

2268
[.description]
@@ -44,85 +90,90 @@ The SQL log type that determines the SQL log format in exceptions.
4490
|`none`
4591

4692

47-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.datasource-name]]`link:#quarkus-doma_quarkus.doma.datasource-name[quarkus.doma.datasource-name]`
93+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.log.sql]]`link:#quarkus-doma_quarkus.doma.log.sql[quarkus.doma.log.sql]`
4894

4995
[.description]
5096
--
51-
The name of the data source.
52-
--|string
53-
|`depends on 'quarkus.datasource."datasource-name".db-kind'`
97+
Shows SQL logs.
98+
--|boolean
99+
|`false`
54100

55101

56-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.batch-size]]`link:#quarkus-doma_quarkus.doma.batch-size[quarkus.doma.batch-size]`
102+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.log.dao]]`link:#quarkus-doma_quarkus.doma.log.dao[quarkus.doma.log.dao]`
57103

58104
[.description]
59105
--
60-
The batch size.
61-
--|int
62-
|`0`
106+
Shows DAO logs.
107+
--|boolean
108+
|`false`
63109

64110

65-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.fetch-size]]`link:#quarkus-doma_quarkus.doma.fetch-size[quarkus.doma.fetch-size]`
111+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.log.closing-failure]]`link:#quarkus-doma_quarkus.doma.log.closing-failure[quarkus.doma.log.closing-failure]`
66112

67113
[.description]
68114
--
69-
The fetch size.
70-
--|int
71-
|`0`
115+
Shows the logs of the failure to close JDBC resource.
116+
--|boolean
117+
|`false`
72118

73119

74-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.max-rows]]`link:#quarkus-doma_quarkus.doma.max-rows[quarkus.doma.max-rows]`
120+
h|[[quarkus-doma_quarkus.doma.named-data-sources]]link:#quarkus-doma_quarkus.doma.named-data-sources[Additional named datasources]
121+
122+
h|Type
123+
h|Default
124+
125+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-name-.dialect]]`link:#quarkus-doma_quarkus.doma.-datasource-name-.dialect[quarkus.doma."datasource-name".dialect]`
75126

76127
[.description]
77128
--
78-
The max rows.
79-
--|int
80-
|`0`
129+
The SQL dialect.
130+
--|`db2`, `h2`, `mssql`, `mysql`, `oracle`, `postgres`, `standard`, `sqlite`
131+
|`depends on 'quarkus.datasource.db-kind'`
81132

82133

83-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.query-timeout]]`link:#quarkus-doma_quarkus.doma.query-timeout[quarkus.doma.query-timeout]`
134+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-name-.batch-size]]`link:#quarkus-doma_quarkus.doma.-datasource-name-.batch-size[quarkus.doma."datasource-name".batch-size]`
84135

85136
[.description]
86137
--
87-
The query timeout limit in seconds.
138+
The batch size.
88139
--|int
89140
|`0`
90141

91142

92-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.sql-load-script]]`link:#quarkus-doma_quarkus.doma.sql-load-script[quarkus.doma.sql-load-script]`
143+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-name-.fetch-size]]`link:#quarkus-doma_quarkus.doma.-datasource-name-.fetch-size[quarkus.doma."datasource-name".fetch-size]`
93144

94145
[.description]
95146
--
96-
Name of the file containing the SQL statements to execute when Doma starts. Its default value differs depending on the Quarkus launch mode:
97-
* In dev and test modes, it defaults to `import.sql`. Simply add an `import.sql` file in the root of your resources directory and it will be picked up without having to set this property. Pass `no-file` to force Doma to ignore the SQL import file. * In production mode, it defaults to `no-file`. It means Doma won't try to execute any SQL import file by default. Pass an explicit value to force Doma to execute the SQL import file.
98-
--|string
99-
|`import.sql in DEV, TEST ; no-file otherwise`
147+
The fetch size.
148+
--|int
149+
|`0`
100150

101151

102-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.log.sql]]`link:#quarkus-doma_quarkus.doma.log.sql[quarkus.doma.log.sql]`
152+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-name-.max-rows]]`link:#quarkus-doma_quarkus.doma.-datasource-name-.max-rows[quarkus.doma."datasource-name".max-rows]`
103153

104154
[.description]
105155
--
106-
Shows SQL logs.
107-
--|boolean
108-
|`false`
156+
The max rows.
157+
--|int
158+
|`0`
109159

110160

111-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.log.dao]]`link:#quarkus-doma_quarkus.doma.log.dao[quarkus.doma.log.dao]`
161+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-name-.query-timeout]]`link:#quarkus-doma_quarkus.doma.-datasource-name-.query-timeout[quarkus.doma."datasource-name".query-timeout]`
112162

113163
[.description]
114164
--
115-
Shows DAO logs.
116-
--|boolean
117-
|`false`
165+
The query timeout limit in seconds.
166+
--|int
167+
|`0`
118168

119169

120-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.log.closing-failure]]`link:#quarkus-doma_quarkus.doma.log.closing-failure[quarkus.doma.log.closing-failure]`
170+
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-name-.sql-load-script]]`link:#quarkus-doma_quarkus.doma.-datasource-name-.sql-load-script[quarkus.doma."datasource-name".sql-load-script]`
121171

122172
[.description]
123173
--
124-
Shows the logs of the failure to close JDBC resource.
125-
--|boolean
126-
|`false`
174+
Name of the file containing the SQL statements to execute when Doma starts. Its default value differs depending on the Quarkus launch mode:
175+
* In dev and test modes, it defaults to `import.sql`. Simply add an `import.sql` file in the root of your resources directory and it will be picked up without having to set this property. Pass `no-file` to force Doma to ignore the SQL import file. * In production mode, it defaults to `no-file`. It means Doma won't try to execute any SQL import file by default. Pass an explicit value to force Doma to execute the SQL import file.
176+
--|string
177+
|`import.sql in DEV, TEST ; no-file otherwise`
127178

128-
|===
179+
|===

0 commit comments

Comments
 (0)