53 lines
1.6 KiB
Markdown
53 lines
1.6 KiB
Markdown
# Entity maker
|
|
|
|
## Description
|
|
|
|
Application connects to postgres database, inspects targeted table and creates:
|
|
|
|
- sqlalchemy table
|
|
- model
|
|
- filter
|
|
- load options
|
|
- repository
|
|
- manager
|
|
- factory
|
|
|
|
Generated source files are targeted for Python 3.13 using SQLAlchemy.
|
|
|
|
## Input parameters
|
|
|
|
Application have following command line parameters:
|
|
- optional db host - default `localhost`
|
|
- optional db port - default `5432`
|
|
- optional db name
|
|
- optional db schema - default `public`
|
|
- optional db user - default `postgres`
|
|
- optional db password - default `postgres`
|
|
- optional db table
|
|
- optional output directory
|
|
- optional entity name
|
|
|
|
When application starts, it will offer users to enter missing parameters from command line, using defaults as listed above. Save entered values in `~/.config/entity-maker` and use it for the next time.
|
|
|
|
Generated files are placed in specificied output directory, in subdirectory named after table name, but in sigular. Check naming section for details.
|
|
|
|
## Examples
|
|
|
|
Example sql table structure is located in `./example/cashbag_conforms.sql`.
|
|
Example output is located in `./example/cashbag_conform`.
|
|
|
|
## Naming example
|
|
|
|
Table name: `cashbag_conforms`.
|
|
Output subdirectory: `cashbag_conform`
|
|
Model name: `CashbagConform`
|
|
Filter name `CashbagConformFilter`
|
|
Load options name `CashbagConformLoadOptions`
|
|
Repository name `CashbagConformRepository`
|
|
Manager name `CashbagConformManager`
|
|
Factory name `CashbagConformFactory`
|
|
|
|
## Technologies used
|
|
|
|
This is command line application. Application is written in golang. Application needs to be run on Linux only, no need to support other operating systems. Make application output modern and colorful.
|