commit
e2fe799f8e
1 changed files with 7 additions and 7 deletions
14
README.md
14
README.md
|
|
@ -105,23 +105,23 @@ Done
|
||||||
```
|
```
|
||||||
Procedure is similar for MySQL, CockroachDB, MariaDB and SQLite. For example:
|
Procedure is similar for MySQL, CockroachDB, MariaDB and SQLite. For example:
|
||||||
```sh
|
```sh
|
||||||
jet -source=mysql -dsn="user:pass@tcp(localhost:3306)/dbname" -path=./gen
|
jet -source=mysql -dsn="user:pass@tcp(localhost:3306)/dbname" -path=./.gen
|
||||||
jet -dsn=postgres://user:pass@localhost:26257/jetdb?sslmode=disable -schema=dvds -path=./.gen #cockroachdb
|
jet -dsn=postgres://user:pass@localhost:26257/jetdb?sslmode=disable -schema=dvds -path=./.gen #cockroachdb
|
||||||
jet -dsn="mariadb://user:pass@tcp(localhost:3306)/dvds" -path=./gen # source flag can be omitted if data source appears in dsn
|
jet -dsn="mariadb://user:pass@tcp(localhost:3306)/dvds" -path=./.gen # source flag can be omitted if data source appears in dsn
|
||||||
jet -source=sqlite -dsn="/path/to/sqlite/database/file" -schema=dvds -path=./gen
|
jet -source=sqlite -dsn="/path/to/sqlite/database/file" -schema=dvds -path=./.gen
|
||||||
jet -dsn="file:///path/to/sqlite/database/file" -schema=dvds -path=./gen # sqlite database assumed for 'file' data sources
|
jet -dsn="file:///path/to/sqlite/database/file" -schema=dvds -path=./.gen # sqlite database assumed for 'file' data sources
|
||||||
```
|
```
|
||||||
_*User has to have a permission to read information schema tables._
|
_*User has to have a permission to read information schema tables._
|
||||||
|
|
||||||
As command output suggest, Jet will:
|
As command output suggest, Jet will:
|
||||||
- connect to postgres database and retrieve information about the _tables_, _views_ and _enums_ of `dvds` schema
|
- connect to postgres database and retrieve information about the _tables_, _views_ and _enums_ of `dvds` schema
|
||||||
- delete everything in schema destination folder - `./gen/jetdb/dvds`,
|
- delete everything in schema destination folder - `./.gen/jetdb/dvds`,
|
||||||
- and finally generate SQL Builder and Model types for each schema table, view and enum.
|
- and finally generate SQL Builder and Model types for each schema table, view and enum.
|
||||||
|
|
||||||
|
|
||||||
Generated files folder structure will look like this:
|
Generated files folder structure will look like this:
|
||||||
```sh
|
```sh
|
||||||
|-- gen # -path
|
|-- .gen # -path
|
||||||
| `-- jetdb # database name
|
| `-- jetdb # database name
|
||||||
| `-- dvds # schema name
|
| `-- dvds # schema name
|
||||||
| |-- enum # sql builder package for enums
|
| |-- enum # sql builder package for enums
|
||||||
|
|
@ -156,7 +156,7 @@ import (
|
||||||
. "github.com/go-jet/jet/v2/examples/quick-start/.gen/jetdb/dvds/table"
|
. "github.com/go-jet/jet/v2/examples/quick-start/.gen/jetdb/dvds/table"
|
||||||
. "github.com/go-jet/jet/v2/postgres"
|
. "github.com/go-jet/jet/v2/postgres"
|
||||||
|
|
||||||
"github.com/go-jet/jet/v2/examples/quick-start/gen/jetdb/dvds/model"
|
"github.com/go-jet/jet/v2/examples/quick-start/.gen/jetdb/dvds/model"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
Let's say we want to retrieve the list of all _actors_ that acted in _films_ longer than 180 minutes, _film language_ is 'English'
|
Let's say we want to retrieve the list of all _actors_ that acted in _films_ longer than 180 minutes, _film language_ is 'English'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue