The Data Layer
Data modeling is core to the development process. As our understanding of the design evolves, so must our code.
hof has a data modeling system that works with the code generation process.
- define data models in CUE, couple these with and into code generators
- generate language types, database tables, libraries, API handlers, and more
- checkpoint the data model and maintain a history for version transforms and migrations
This section expands on our
simple-server to use
We will first
- Create a todo application data model
- Generate Go types and a simple Library
- Start with a Go map for storage, later a database
- Create CRUD routes for the datamodel
After we will see
hof’s code __re__generation capabilites by
- Customizing the generated code
- Updating the data model
- Regenerating our application
- Inspecting and discussing the result
Finally, we will look at how to upgrade our genertor to use a database. Automatic migrations are covered in the model history section.
The full code for this section can be found on GitHub code/first-example/data-layer
Database storage and automatic CRUD handler generation will be covered in more advanced sections.
- Schema - for the Data Model
- Generating Types - for the server
- API Resources - from Data Models
- Custom Code - and iterative development with code gen
- Relations - between types and how to handle them
- Checkpointing - and Data Model history
- Database - upgrading the storage