Refer to Installation for instructions.
Run a sample MySQL database on the port 3306
docker compose up
Running Dozer
dozer
That's all to it. You have APIs instantly available over REST and gRPC.
.____ ___ __________ ____
| _ \ / _ \__ / ____| _ \
| | | | | | |/ /| _| | |_) |
| |_| | |_| / /_| |___| _ <
|____/ \___/____|_____|_| \_\
Dozer Version: 0.1.34
INFO Initiating app: dozer-chinook-mysql
INFO Home dir: ./.dozer
INFO [API] Endpoints
+-----------+----------+
| Path | Name |
+-----------+----------+
| /employee | employee |
+-----------+----------+
| /invoice | invoice |
+-----------+----------+
INFO Source: Initializing input schema: Invoice
+-------------+-----------+----------+-------+
| Field | Type | Nullable | PK |
+-------------+-----------+----------+-------+
| InvoiceId | Int | false | true |
+-------------+-----------+----------+-------+
| CustomerId | Int | false | false |
+-------------+-----------+----------+-------+
| InvoiceDate | Timestamp | false | false |
+-------------+-----------+----------+-------+
| Total | Decimal | false | false |
+-------------+-----------+----------+-------+
INFO Source: Initializing input schema: Employee
+------------+-----------+----------+-------+
| Field | Type | Nullable | PK |
+------------+-----------+----------+-------+
| EmployeeId | Int | false | true |
+------------+-----------+----------+-------+
| LastName | Text | false | false |
+------------+-----------+----------+-------+
| FirstName | Text | false | false |
+------------+-----------+----------+-------+
| Title | Text | true | false |
+------------+-----------+----------+-------+
| ReportsTo | Int | true | false |
+------------+-----------+----------+-------+
| BirthDate | Timestamp | true | false |
+------------+-----------+----------+-------+
| HireDate | Timestamp | true | false |
+------------+-----------+----------+-------+
| Address | Text | true | false |
+------------+-----------+----------+-------+
| City | Text | true | false |
+------------+-----------+----------+-------+
| State | Text | true | false |
+------------+-----------+----------+-------+
| Country | Text | true | false |
+------------+-----------+----------+-------+
| PostalCode | Text | true | false |
+------------+-----------+----------+-------+
| Phone | Text | true | false |
+------------+-----------+----------+-------+
| Fax | Text | true | false |
+------------+-----------+----------+-------+
| Email | Text | true | false |
+------------+-----------+----------+-------+
INFO [pipeline] Validation completed
INFO Created new build v0001
INFO Source: Initializing input schema: Invoice
+-------------+-----------+----------+-------+
| Field | Type | Nullable | PK |
+-------------+-----------+----------+-------+
| InvoiceId | Int | false | true |
+-------------+-----------+----------+-------+
| CustomerId | Int | false | false |
+-------------+-----------+----------+-------+
| InvoiceDate | Timestamp | false | false |
+-------------+-----------+----------+-------+
| Total | Decimal | false | false |
+-------------+-----------+----------+-------+
INFO Source: Initializing input schema: Employee
+------------+-----------+----------+-------+
| Field | Type | Nullable | PK |
+------------+-----------+----------+-------+
| EmployeeId | Int | false | true |
+------------+-----------+----------+-------+
| LastName | Text | false | false |
+------------+-----------+----------+-------+
| FirstName | Text | false | false |
+------------+-----------+----------+-------+
| Title | Text | true | false |
+------------+-----------+----------+-------+
| ReportsTo | Int | true | false |
+------------+-----------+----------+-------+
| BirthDate | Timestamp | true | false |
+------------+-----------+----------+-------+
| HireDate | Timestamp | true | false |
+------------+-----------+----------+-------+
| Address | Text | true | false |
+------------+-----------+----------+-------+
| City | Text | true | false |
+------------+-----------+----------+-------+
| State | Text | true | false |
+------------+-----------+----------+-------+
| Country | Text | true | false |
+------------+-----------+----------+-------+
| PostalCode | Text | true | false |
+------------+-----------+----------+-------+
| Phone | Text | true | false |
+------------+-----------+----------+-------+
| Fax | Text | true | false |
+------------+-----------+----------+-------+
| Email | Text | true | false |
+------------+-----------+----------+-------+
INFO [pipeline] Validation completed
INFO Starting Internal Server on 0.0.0.0:50053
INFO Starting Rest Api Server on http://0.0.0.0:8080 with security: None
INFO starting 8 workers
INFO Tokio runtime found; starting in existing Tokio runtime
INFO Starting gRPC server on 0.0.0.0:50051 with security: None
REST
Filter with limit of 3
curl -X POST http://localhost:8080/invoice/query \
--header 'Content-Type: application/json' \
--data-raw '{"$limit":3}'
[
{
"InvoiceId": 1,
"CustomerId": 2,
"InvoiceDate": "2009-01-01T00:00:00.000Z",
"Total": "1.98",
"__dozer_record_id": 0,
"__dozer_record_version": 1
},
{
"InvoiceId": 2,
"CustomerId": 4,
"InvoiceDate": "2009-01-02T00:00:00.000Z",
"Total": "3.96",
"__dozer_record_id": 1,
"__dozer_record_version": 1
},
{
"InvoiceId": 3,
"CustomerId": 8,
"InvoiceDate": "2009-01-03T00:00:00.000Z",
"Total": "5.94",
"__dozer_record_id": 2,
"__dozer_record_version": 1
}
]
For more about REST in Dozer, see Using REST APIs.
gRPC
Filter with limit of 1
grpcurl -d '{"query": "{\"$limit\": 1}"}' \
-plaintext localhost:50051 \
dozer.generated.invoice.Invoices/query
Response
{
"records": [
{
"record": {
"InvoiceId": "1",
"CustomerId": "2",
"InvoiceDate": "2009-01-01T00:00:00Z",
"Total": {
"scale": 2,
"lo": 198
},
"DozerRecordVersion": 1
}
}
]
}
For more about gRPC in Dozer, see Using gRPC APIs.