homebox/.scaffold/model/scaffold.yaml

34 lines
786 B
YAML
Raw Normal View History

2023-03-05 07:00:28 +00:00
---
2023-03-06 06:30:16 +00:00
# yaml-language-server: $schema=https://hay-kot.github.io/scaffold/schema.json
2023-03-05 07:00:28 +00:00
messages:
pre: |
# Ent Model Generation
With Boilerplate!
post: |
Complete!
questions:
- name: "model"
prompt:
message: "What is the name of the model? (PascalCase)"
required: true
2023-03-06 06:56:53 +00:00
- name: "by_group"
prompt:
confirm: "Include a Group Edge? (group_id -> id)"
required: true
2023-03-05 07:00:28 +00:00
rewrites:
- from: 'templates/model.go'
2023-03-06 06:56:53 +00:00
to: 'backend/internal/data/ent/schema/{{ lower .Scaffold.model }}.go'
inject:
- name: "Insert Groups Edge"
path: 'backend/internal/data/ent/schema/group.go'
at: // $scaffold_edge
template: |
{{- if .Scaffold.by_group -}}
owned("{{ lower .Scaffold.model }}s", {{ .Scaffold.model }}.Type),
{{- end -}}