Skip to content
Levy Araújo Sampaio edited this page Jun 5, 2024 · 2 revisions

General explanation

Our cli has two main funcionalities:

  • Generate and destroy code
  • Manage migrations and database

Code generation

The code generation funcionality create two routes types

  1. CRUD
  2. USECASE

CRUD

The crud command generate:

  • routes and handlers on cmd/http folder
  • domain with ID field on internal/aplication/domain
  • service for each route with a type for request, response and a service file for your business rules
  • repository based on your domain for mysql database comunication

USECASE

The usecase command generate:

  • single route and handler without any dependecy injection
  • service with a type for request, response and a service file for your business rules

Migrator

The migrator is based on atlas: https://atlasgo.io/getting-started If you want can use atlas for manage your database without use the cli

The migrator has 3 commands:

  1. migrate
  2. inspect
  3. generate

Migrate

this command read the tools/migrator/schema/schema.my.hcl file and migrate for the real database connceted with env configuration

Inspect

this command read the connceted database and generate an hcl with this configuration

Generate

Similar to inspect but generate a hcl file on tools/migrator/generated, if you want to use the generated hcl on zord migrations just replace tools/migrator/schema/schema.my.hcl with this file content

Clone this wiki locally