Go Boilerplate Generator
Go Boilerplate Generator is used to generate core modules of boilerplate such as usecase, service, repository, models, and entity.
It is use Clean Architecture and Domain-Driven Design.
You can generate a whole modules just by running this command.
Installation
The following command is used for install it into your local
go install github.com/Muruyung/go-boilgen@latest
Requirement
If you want to generate code for a new project, you have to do init first
go mod init project-name
If you want to generate code for a new project or also an old project, you need to add this dependencies into your project
go get github.com/Muruyung/go-utilities@latest
Command
This is example basic command using default method
go-boilgen -s service_name -n module_name -f "field_name1:data_type,field_name2:data_type" -m "method1,method2"
You can just generate entity only using flag --entity-only.
go-boilgen -s service_name -n module_name -f "field_name1:data_type,field_name2:data_type" --entity-only
If you want to generate custom method, you must use the flag -c (or --custom-method), -p (or --params), and -r (or --return, optional)
go-boilgen -s service_name -n module_name -c custom_method_name -p "field_name1:data_type,field_name2:data_type" -r "field_name1:data_type,field_name2:data_type"
Use this command for more information about Go-Boilgen.
go-boilgen --help