command
Version:
v0.0.0-...-1f910d1
Opens a new window with list of versions in this module.
Published: Aug 25, 2024
License: MIT
Opens a new window with license information.
Imports: 11
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Entity Generator
Generate entity/repo from database table
task gen-entity
# or
rm -rf internal/generated/entity
go run ./tools/entity-gen
Table Convention
Code generation based assumption that table follow below conventions:
- Tables only have a single primary key called
id
with data type SERIAL
or BIGSERIAL
- Audit columns (i.e.
created_at
, updated_at
, and deleted_at
) are mandatory. Generated entities don't include these columns
- Hard delete is not allowed. The select operation doesn't show soft-deleted rows.
Supported data type
The code generation only support below data type:
integer
--> int
bigint
--> int64
text
--> string
timestamp
--> time.Time
Please add additional data type support at convertToFieldType()
function.
Database Transaction
- Repo check flag to use database transcation and store the error in the
context.Context
BEGIN
should be called before called the operation via dbtxn.Begin()
- Check the example at clock_svc.go
- Find the library at dbtxn
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.