Readme update.
This commit is contained in:
parent
3dddd2f6bf
commit
8be33b8774
1 changed files with 13 additions and 13 deletions
26
README.md
26
README.md
|
|
@ -53,16 +53,18 @@ Generating enum model files...
|
||||||
Done
|
Done
|
||||||
```
|
```
|
||||||
As jetgen command output suggest, jetgen will:
|
As jetgen command output suggest, jetgen will:
|
||||||
- connect to postgres database and retrieve information about the tables and enums of `dvds` schema\
|
- connect to postgres database and retrieve information about the tables and enums of `dvds` schema
|
||||||
- delete everything in destination folder `./gen`,
|
- delete everything in destination folder `./gen`,
|
||||||
- and finally generate sql builder and model Go files for all schema tables and enums in destination folder `./gen`.\
|
- and finally generate sql builder and model Go files for each schema tables and enums into destination folder `./gen`.
|
||||||
Generated files folder looks like this:
|
|
||||||
|
|
||||||
|
Generated files folder structure will look like this:
|
||||||
```sh
|
```sh
|
||||||
|-- gen # destination folder
|
|-- gen # destination folder
|
||||||
| `-- jetdb # database name
|
| `-- jetdb # database name
|
||||||
| `-- dvds # schema name
|
| `-- dvds # schema name
|
||||||
| |-- enum # sql builder folder for enums
|
| |-- enum # sql builder folder for enums
|
||||||
| | `-- mpaa_rating.go
|
| | |-- mpaa_rating.go
|
||||||
| |-- table # sql builder folder for tables
|
| |-- table # sql builder folder for tables
|
||||||
| |-- actor.go
|
| |-- actor.go
|
||||||
| |-- address.go
|
| |-- address.go
|
||||||
|
|
@ -121,9 +123,7 @@ args - are parameters for the query
|
||||||
<details>
|
<details>
|
||||||
<summary>Click to see</summary>
|
<summary>Click to see</summary>
|
||||||
|
|
||||||
```sh
|
```sql
|
||||||
Parameterized query:
|
|
||||||
|
|
||||||
SELECT actor.actor_id AS "actor.actor_id",
|
SELECT actor.actor_id AS "actor.actor_id",
|
||||||
actor.first_name AS "actor.first_name",
|
actor.first_name AS "actor.first_name",
|
||||||
actor.last_name AS "actor.last_name",
|
actor.last_name AS "actor.last_name",
|
||||||
|
|
@ -155,10 +155,12 @@ FROM dvds.actor
|
||||||
INNER JOIN dvds.category ON (category.category_id = film_category.category_id)
|
INNER JOIN dvds.category ON (category.category_id = film_category.category_id)
|
||||||
WHERE ((language.name = $1) AND (category.name != $2)) AND (film.length > $3)
|
WHERE ((language.name = $1) AND (category.name != $2)) AND (film.length > $3)
|
||||||
ORDER BY actor.actor_id ASC, film.film_id ASC;
|
ORDER BY actor.actor_id ASC, film.film_id ASC;
|
||||||
|
```
|
||||||
Arguments:
|
```sh
|
||||||
[English Action 180]
|
[English Action 180]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
To see debug sql that can be copy pasted to sql editor and executed.
|
To see debug sql that can be copy pasted to sql editor and executed.
|
||||||
|
|
@ -169,9 +171,7 @@ query - is parametrized query where every parameter is replaced with appropriate
|
||||||
<details>
|
<details>
|
||||||
<summary>Click to see</summary>
|
<summary>Click to see</summary>
|
||||||
|
|
||||||
```sh
|
```sql
|
||||||
Debug sql:
|
|
||||||
|
|
||||||
SELECT actor.actor_id AS "actor.actor_id",
|
SELECT actor.actor_id AS "actor.actor_id",
|
||||||
actor.first_name AS "actor.first_name",
|
actor.first_name AS "actor.first_name",
|
||||||
actor.last_name AS "actor.last_name",
|
actor.last_name AS "actor.last_name",
|
||||||
|
|
@ -220,7 +220,7 @@ var dest []struct {
|
||||||
```
|
```
|
||||||
_There is no limitation for how big or nested destination structure can be._
|
_There is no limitation for how big or nested destination structure can be._
|
||||||
|
|
||||||
Now to lets execute a above statement on open database connection db.
|
Now to lets execute a above statement on open database connection db and store result into `dest`.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
err := stmt.Query(db, &dest)
|
err := stmt.Query(db, &dest)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue