-
Notifications
You must be signed in to change notification settings - Fork 4
Generators
The following generators are available. It’s only an overview, for more information run the generators without arguments for a help page.
disco generate scaffold RESOURCE [ATTR:TYPE ...]
This is similar to the rails scaffold generator. It creates a models with a migration and a projection. Also it creates commands and events for standard CRUD actions, as well as handlers for them in command processor, controller and projections.
Finally it adds a route for the resource.
Attributes are given with its type, like e.g. title:string
.
disco generate command COMMAND_NAME [ATTR ....] [--event=EVENT_NAME] [--processor=PROCESSOR_NAME]
This generators a command and an event with the given name. Additional it creates a command_processor if none exists and adds the code for processing the newly generated code.
The COMMAND_NAME should be something like: created_post
or CreatedPost
Attributes are given WITHOUT types. Commands are stored serialized therefore the names are sufficient.
disco generate model RESOURCE [ATTR:TYPE ...] [--domain]
This one creates a model, a projection and a migration. With the —domain option you can specify, that you want to create the resource for your domain.
Attributes are given with its type, like e.g. title:string
.
disco generate projection NAME [EVENT EVENT] [--domain]
The final one creates a projection with methods for the events given. With the —domain option you can specify, that you want to create the projection for your domain.