Appliers
Package source: src/srv/appliers/
Meet the Appliers — post-creation orchestrators that run after a domain entity (model, field, relation, actor, project, …) is persisted to the database. Each applier receives the freshly-created entity and a context, then cascades a sequence of side-effects: creating dependent services, registering routes, generating configuration, updating related structures, and wiring CRUD actors. Appliers are the mechanism that makes Gen-Code deterministic — every entity creation triggers a predictable, reproducible set of downstream actions.
Table of Contents
actor_create_applier.go
You encounter this applier whenever an actor (a MAE entry point for a page or action) is created. It dispatches actor-creation logic based on the actor’s Kind — each kind (Display, See, Perform, Instruct, Custom, Overview) has a dedicated configurator or inline handler that generates the appropriate MAE structure, routes, and bindings.
- Struct:
ActorCreateApplier
| Field | Type |
|---|---|
| MaeConfigurator | *configurators.MaeConfigurator |
| Handlers | *handlers.Handlers |
| Inflector | *inflectors.Inflector |
| Jsoner | *jsoner.Jsoner |
| Explorer | *explorers.Explorer |
| Configurator | *configurators.Configurator |
| FormConfigurator | *configurators.FormConfigurator |
| ProjectContexter | *contexters.ProjectContexter |
| SeeConfigurator | *configurators.SeeConfigurator |
| PerformConfigurator | *configurators.PerformConfigurator |
| DisplayConfigurator | *configurators.DisplayConfigurator |
| ModelFetcher | *fetchers.ModelFetcher |
| BreadcrumbsConfigurator | *configurators.BreadcrumbsConfigurator |
| RouteConfigurator | *configurators.RouteConfigurator |
| OverviewConfigurator | *configurators.OverviewConfigurator |
- Struct:
ActorCreateApplierMod
| Field | Type | Notes |
|---|---|---|
| ModelId | string |
Optional model ID context for the applier |
Methods
The following methods are exposed by ActorCreateApplier. Act is the primary entry point; the remaining methods are kind-specific delegates called from within Act.
| Signature | Description |
|---|---|
Mod() *ActorCreateApplierMod |
Returns a zero-value ActorCreateApplierMod. |
Act(ctx context.Context, actor *mdl.Actor, mod *ActorCreateApplierMod) error |
Generates the MAE structure for the actor then delegates to the appropriate kind-specific configurator (Display → DisplayConfigurator, See → SeeConfigurator, Perform → PerformConfigurator, Instruct → configureInstruct, Custom → no-op, Overview → OverviewConfigurator). Panics on unknown kinds. |
configureInstruct(ctx context.Context, actor *mdl.Actor, ids *configurators.MaeStructureIds) |
Configures an Instruct actor: creates an app route, a binder, a perform form, and a single PerformStep on the maestro. |
form_field_create_applier.go
This applier runs whenever a FormField is added to a form. It creates the corresponding StructureField in the owning form’s structure, handling both primitive field kinds and embedding (nested form) field kinds so that the generated code’s type system stays in sync with the form definition.
- Struct:
FormFieldCreateApplier
| Field | Type |
|---|---|
| Inflector | *inflectors.Inflector |
| StructureFetcher | *fetchers.StructureFetcher |
| StructureHandler | *handlers.StructureHandler |
| StructureFieldHandler | *handlers.StructureFieldHandler |
| FormFieldHandler | *handlers.FormFieldHandler |
| FormFetcher | *fetchers.FormFetcher |
| ProjectContexter | *contexters.ProjectContexter |
| Logger | *logger.Logger |
| Jsoner | *jsoner.Jsoner |
Methods
The following methods are exposed by FormFieldCreateApplier.
| Signature | Description |
|---|---|
Act(ctx context.Context, formField *mdl.FormField) |
Main entry point. Resolves the parent form and its structure, then either creates a primitive StructureField (via convertFormFieldKind) or delegates to dealWithEmbedding. Updates the form field with its label and the new StructureFieldId. |
convertFormFieldKind(formField *mdl.FormField) string |
Maps a FormField.Kind constant to its corresponding StructureFieldPrimitive string (e.g., FormFieldKindTextInput → StructureFieldPrimitiveString, FormFieldKindBooleanInput → StructureFieldPrimitiveBoolean). Panics on unknown kinds. |
dealWithEmbedding(ctx context.Context, form *mdl.Form, formField *mdl.FormField, structure *mdl.Structure) |
For embedding fields: unmarshals the embedding data, creates a new Structure for the embedded form (kind StructureKindForm), and creates a StructureField of kind StructureFieldKindStructure with pointer/array flags derived from the embedding data. |
model_create_applier.go
This is the applier you will encounter most often during normal development. It orchestrates all side-effects for a newly created Model: registering services, setting up CRUD actors and views, and seeding the standard utility fields (id, created_at, updated_at). Every model in a project passes through this applier on creation.
- Struct:
ModelCreateApplier
| Field | Type |
|---|---|
| ModelServicesConfigurator | *configurators.ModelServicesConfigurator |
| AutoCompleterServiceConfigurator | *configurators.AutoCompleterServiceConfigurator |
| ModelStructuresConfigurator | *configurators.ModelStructuresConfigurator |
| ModelShowConfigurator | *configurators.ModelShowConfigurator |
| ModelNewConfigurator | *configurators.ModelNewConfigurator |
| ModelCreateConfigurator | *configurators.ModelCreateConfigurator |
| ModelEditConfigurator | *configurators.ModelEditConfigurator |
| ModelUpdateConfigurator | *configurators.ModelUpdateConfigurator |
| ModelListConfigurator | *configurators.ModelListConfigurator |
| ModelDeleteConfigurator | *configurators.ModelDeleteConfigurator |
| ActionButtonsConfigurator | *configurators.ActionButtonsConfigurator |
| HomeConfigurator | *configurators.HomeConfigurator |
| ModelFieldHandler | *handlers.ModelFieldHandler |
| ModelFieldCreateApplier | *ModelFieldCreateApplier |
| ProjectConfigFetcher | *fetchers.ProjectConfigFetcher |
| ProjectContexter | *contexters.ProjectContexter |
| BreadcrumbsConfigurator | *configurators.BreadcrumbsConfigurator |
- Struct:
ModelCreateApplierMod
Empty modifier struct; reserved for future options.
Methods
The following methods are exposed by ModelCreateApplier.
| Signature | Description |
|---|---|
Mod() *ModelCreateApplierMod |
Returns a zero-value ModelCreateApplierMod. |
Act(ctx context.Context, model *mdl.Model, mod *ModelCreateApplierMod) |
Main entry point. Fetches the project config, calls basicServices, conditionally calls crud if model.Crud is true, then calls basicModelFields. |
createModelField(ctx context.Context, modelField *mdl.ModelField) |
Persists a ModelField via the handler and immediately runs ModelFieldCreateApplier.Act on it. |
crud(ctx context.Context, model *mdl.Model, config *mdl.ProjectConfig, mod *ModelCreateApplierMod) |
Runs all CRUD configurators in sequence: Show, New, Create, Edit, Update, List, Delete, ActionButtons, Home (model create), and Breadcrumbs (model create). |
basicModelFields(ctx context.Context, model *mdl.Model) |
Seeds the three utility fields: id (kind id), created_at (kind time), updated_at (kind time), each with Utility: true. |
basicServices(ctx context.Context, model *mdl.Model) |
Calls ModelServicesConfigurator.GenerateConfig, AutoCompleterServiceConfigurator.GenerateConfig, and ModelStructuresConfigurator.GenerateConfig. |
model_delete_applier.go
This applier runs when a Model is removed. It cleans up all artefacts associated with the deleted model — actors, services (including children), autocompleter data, and entity/form structures — so that the generated project remains consistent after the deletion.
- Struct:
ModelDeleteApplier
| Field | Type |
|---|---|
| ServiceFetcher | *fetchers.ServiceFetcher |
| ActorFetcher | *fetchers.ActorFetcher |
| ServiceHandler | *handlers.ServiceHandler |
| ActorHandler | *handlers.ActorHandler |
| Jsoner | *jsoner.Jsoner |
| MaeConfigurator | *configurators.MaeConfigurator |
| Inflector | *inflectors.Inflector |
| HomeConfigurator | *configurators.HomeConfigurator |
| StructureFetcher | *fetchers.StructureFetcher |
| StructureHandler | *handlers.StructureHandler |
| ProjectContexter | *contexters.ProjectContexter |
Methods
The following methods are exposed by ModelDeleteApplier.
| Signature | Description |
|---|---|
Act(ctx context.Context, model *mdl.Model) |
Orchestrates the full deletion sequence: deleteActors → deleteServices → deleteModelIdIntoCompleterData → HomeConfigurator.ConfigureModelDelete → deleteMdlStructure → deleteFormsStructures. |
deleteServices(ctx context.Context, model *mdl.Model) |
Fetches all services linked to the model and deletes them. For each deleted service, also deletes child services found via FindSetByParentId. |
deleteActors(ctx context.Context, model *mdl.Model) |
Fetches all actors scoped to the project and linked to the model, then deletes each one. |
deleteModelIdIntoCompleterData(ctx context.Context, model *mdl.Model) |
Reads the autocompleter service’s JSON data, removes the model’s ID from ModelsIds, and saves the updated data back. |
deleteMdlStructure(ctx context.Context, model *mdl.Model) |
Finds the entity Structure matching the Pascalized model name and kind StructureKindEntity, then deletes it. |
deleteFormsStructures(ctx context.Context, model *mdl.Model) |
Computes the names Create<Model>Form and Update<Model>Form and delegates to deleteFormStructure for each. |
deleteFormStructure(ctx context.Context, structureName string) |
Finds a Structure of kind StructureKindForm by exact name match within the project scope and deletes it. |
model_field_create_applier.go
This applier fires whenever a field is added to a model. It sets the field’s display position, creates a ModelConfig record, regenerates service/structure configs, and updates all CRUD views if the parent model has CRUD enabled — keeping every generated view in sync with the model’s current field set.
- Struct:
ModelFieldCreateApplier
| Field | Type |
|---|---|
| Explorer | *explorers.Explorer |
| ModelServicesConfigurator | *configurators.ModelServicesConfigurator |
| AutoCompleterServiceConfigurator | *configurators.AutoCompleterServiceConfigurator |
| ModelStructuresConfigurator | *configurators.ModelStructuresConfigurator |
| ModelShowConfigurator | *configurators.ModelShowConfigurator |
| ModelNewConfigurator | *configurators.ModelNewConfigurator |
| ModelCreateConfigurator | *configurators.ModelCreateConfigurator |
| ModelEditConfigurator | *configurators.ModelEditConfigurator |
| ModelUpdateConfigurator | *configurators.ModelUpdateConfigurator |
| ModelListConfigurator | *configurators.ModelListConfigurator |
| MigrationConfigurator | *configurators.MigrationConfigurator |
| ModelFieldHandler | *handlers.ModelFieldHandler |
| ModelConfigHandler | *handlers.ModelConfigHandler |
| ProjectConfigFetcher | *fetchers.ProjectConfigFetcher |
| ModelFieldFetcher | *fetchers.ModelFieldFetcher |
| Logger | *logger.Logger |
| ProjectContexter | *contexters.ProjectContexter |
- Struct:
ModelFieldCreateApplierMod
Empty modifier struct; reserved for future options.
Methods
The following methods are exposed by ModelFieldCreateApplier.
| Signature | Description |
|---|---|
Act(ctx context.Context, modelField *mdl.ModelField, mod *ModelFieldCreateApplierMod) error |
Main entry point. Fetches the project config, resolves the parent model, sets the field’s display position, creates a ModelConfig, regenerates service/autocompleter/structure configs, reloads the field, invokes crudModel, and triggers migration config. |
crudModel(ctx context.Context, modelField *mdl.ModelField, model *mdl.Model, projectConfig *mdl.ProjectConfig) |
If model.Crud is true, regenerates Show, New, Create, Edit, Update views and invokes precise-config methods for Show, Create, Update, and List for the specific field. |
setPosition(ctx context.Context, modelField *mdl.ModelField, model *mdl.Model) *mdl.ModelField |
Counts existing fields scoped to the model, sets modelField.Position to count + 1, and persists the field via ModelFieldHandler.MustUpdate. Returns the updated field. |
model_field_update_applier.go
A thin applier that runs after any ModelField is updated. Its sole responsibility is refreshing the related form fields so that displayed labels and configuration remain consistent with the updated model field definition.
- Struct:
ModelFieldUpdateApplier
| Field | Type |
|---|---|
| Logger | *logger.Logger |
| ModelFormConfigurator | *configurators.ModelFormConfigurator |
Methods
The following method is exposed by ModelFieldUpdateApplier.
| Signature | Description |
|---|---|
Act(ctx context.Context, modelField *mdl.ModelField) |
Logs the update event and calls ModelFormConfigurator.UpdateRelatedFormFields to synchronize any form fields that depend on the updated model field. |
model_kinship_create_applier.go
This applier runs when a ModelKinship is created — that is, when a parent-child relationship between two models via a through-relation is established. It marks the via-field as a parent field and configures breadcrumbs so that nested resources display the correct navigation trail.
- Struct:
ModelKinshipCreateApplier
| Field | Type |
|---|---|
| Logger | *logger.Logger |
| Explorer | *explorers.Explorer |
| Handlers | *handlers.Handlers |
| ModelRelationFetcher | *fetchers.ModelRelationFetcher |
| ModelFieldFetcher | *fetchers.ModelFieldFetcher |
| ModelFieldHandler | *handlers.ModelFieldHandler |
| Jsoner | *jsoner.Jsoner |
| BreadcrumbsConfigurator | *configurators.BreadcrumbsConfigurator |
Methods
The following method is exposed by ModelKinshipCreateApplier.
| Signature | Description |
|---|---|
Act(ctx context.Context, modelKinship *mdl.ModelKinship) |
Fetches the through-relation and its via-field. Unmarshals the field’s Data as ModelFieldDataRelationId, sets IsParent: true, re-marshals and saves. Then calls BreadcrumbsConfigurator.ConfigureModelKinshipCreate. |
model_relation_create_applier.go
This applier runs whenever a relation between two models is defined. It creates the foreign-key model field if absent, links the reverse side of the relation, assigns a display position, and regenerates all affected service and CRUD configurations — keeping both sides of the association fully wired in the generated code.
- Struct:
ModelRelationCreateApplier
| Field | Type |
|---|---|
| Logger | *logger.Logger |
| Explorer | *explorers.Explorer |
| Inflector | *inflectors.Inflector |
| ModelFieldCreateApplier | *ModelFieldCreateApplier |
| ModelRelationHandler | *handlers.ModelRelationHandler |
| ModelFieldHandler | *handlers.ModelFieldHandler |
| ModelServicesConfigurator | *configurators.ModelServicesConfigurator |
| AutoCompleterServiceConfigurator | *configurators.AutoCompleterServiceConfigurator |
| ModelStructuresConfigurator | *configurators.ModelStructuresConfigurator |
| ModelShowConfigurator | *configurators.ModelShowConfigurator |
| ModelNewConfigurator | *configurators.ModelNewConfigurator |
| ModelCreateConfigurator | *configurators.ModelCreateConfigurator |
| ModelEditConfigurator | *configurators.ModelEditConfigurator |
| ModelUpdateConfigurator | *configurators.ModelUpdateConfigurator |
| ModelListConfigurator | *configurators.ModelListConfigurator |
| ProjectConfigFetcher | *fetchers.ProjectConfigFetcher |
| ProjectContexter | *contexters.ProjectContexter |
Methods
The following methods are exposed by ModelRelationCreateApplier.
| Signature | Description |
|---|---|
Act(ctx context.Context, modelRelation *mdl.ModelRelation) |
Main entry point. Fetches the project config and parent model, then calls createViaIdRelationModelField, populateReversedFields, setPosition, regenerates service/autocompleter/structure configs, and calls crudSupporting. |
crudSupporting(ctx context.Context, modelRelation *mdl.ModelRelation, model *mdl.Model, projectConfig *mdl.ProjectConfig) |
If model.Crud is true, regenerates Show, New, Create, Edit, and Update configurators, plus calls ModelListConfigurator.CreateModelRelationPreciseConfig for the specific relation. |
setPosition(ctx context.Context, modelRelation *mdl.ModelRelation, model *mdl.Model) *mdl.ModelRelation |
Counts existing relations scoped to the model, sets modelRelation.Position to count + 1, and persists via ModelRelationHandler.MustUpdate. Returns the updated relation. |
populateReversedFields(ctx context.Context, modelRelation *mdl.ModelRelation) *mdl.ModelRelation |
For non-owner relations, finds the owner relation on the reverse model and sets ReversedId on both sides, persisting both updates. Logs a warning if the reverse cannot be found. |
createViaIdRelationModelField(ctx context.Context, modelRelation *mdl.ModelRelation) *mdl.ModelRelation |
If modelRelation.ViaId is empty (only valid for ModelRelationKindOne), creates a new ModelField of kind ModelFieldKindRelationId named <to_model>_id, applies it, and sets the relation’s ViaId. Panics for non-one relations without a via-field. |
model_validation_create_applier.go
A placeholder applier that reacts to a new ModelValidation. It currently fetches the associated forms but performs no further action — this is a stub for future validation propagation logic.
- Struct:
ModelValidationCreateApplier
| Field | Type |
|---|---|
| Logger | *logger.Logger |
| FormFetcher | *fetchers.FormFetcher |
| ProjectContexter | *contexters.ProjectContexter |
Methods
The following method is exposed by ModelValidationCreateApplier.
| Signature | Description |
|---|---|
Act(ctx context.Context, modelValidation *mdl.ModelValidation) |
Logs the applier start, fetches all forms linked to the validation’s model within the project scope, and iterates them. |
project_create_applier.go
The largest and most consequential applier — it bootstraps an entire new project. When a project is created, this applier creates the canonical set of system models (event, user, ACL models), standard commands (web, optional tray), miscellaneous routes, the home MAE, ACL/timeline MAEs, all dependencies, and optionally adds depiction support. Everything else in the system ultimately depends on the work this applier does.
- Struct:
ProjectCreateApplier
| Field | Type |
|---|---|
| BaseServicesConfigurator | *configurators.BaseServicesConfigurator |
| Logger | *logger.Logger |
| DbHandler | *handlers.DbHandler |
| CommandHandler | *handlers.CommandHandler |
| ServiceHandler | *handlers.ServiceHandler |
| RouteHandler | *handlers.RouteHandler |
| MaeConfigurator | *configurators.MaeConfigurator |
| Configurator | *configurators.Configurator |
| GocConfigurator | *configurators.GocConfigurator |
| ServiceFetcher | *fetchers.ServiceFetcher |
| ModelHandler | *handlers.ModelHandler |
| ModelCreateApplier | *ModelCreateApplier |
| ModelRelationCreateApplier | *ModelRelationCreateApplier |
| ModelFieldHandler | *handlers.ModelFieldHandler |
| ModelFieldCreateApplier | *ModelFieldCreateApplier |
| Inflector | *inflectors.Inflector |
| ProjectConfigFetcher | *fetchers.ProjectConfigFetcher |
| ProjectConfigCompanion | *companions.ProjectConfigCompanion |
| Jsoner | *jsoner.Jsoner |
| ActorCreateApplier | *ActorCreateApplier |
| ProjectContexter | *contexters.ProjectContexter |
| DependencyHandler | *handlers.DependencyHandler |
| ProjectConfigHandler | *handlers.ProjectConfigHandler |
| Uuider | *uuider.Uuider |
| Depictor | *depictors.Depictor |
| ModelRelationHandler | *handlers.ModelRelationHandler |
| ModelFetcher | *fetchers.ModelFetcher |
| ModelFieldFetcher | *fetchers.ModelFieldFetcher |
Methods
The following methods are exposed by ProjectCreateApplier. Act is the primary entry point; all other methods are private delegates called from within Act or from each other.
| Signature | Description |
|---|---|
Act(ctx context.Context, project *mdl.Project) |
Main entry point. Retrieves or creates the project config, sets the sync ID, adds dependencies, generates base services, creates the home/timeline/ACL MAEs, creates the web command and DB record, seeds the event/user/ACL system models, registers miscellaneous routes, configures the GinRouter setup service, and optionally adds tray support and depiction. |
createTimelineMae(ctx context.Context) |
Creates a SeeEvents actor and applies it via ActorCreateApplier. |
createAclMae(ctx context.Context) |
Creates SeeAcl (See kind) and PerformAcl (Perform kind) actors and applies both. |
createHomeMae(ctx context.Context) |
Creates a Home Overview actor, generates its MAE structure, adds a WelcomeStep, configures the HTML view, marks it as IsHomeView, adds title/welcome/grid sections, creates the app GET / route, and registers a breadcrumb. |
createAndApplyModelField(ctx context.Context, field *mdl.ModelField) |
Creates a model field via the handler and immediately applies it with ModelFieldCreateApplier. |
eventModel(ctx context.Context) |
Creates the system event model (non-CRUD) and seeds the fields: what, who, when, why, resource_id, resource_type. |
aclModels(ctx context.Context, config *mdl.ProjectConfig) |
Orchestrates creation of all ACL system models: ra, ras, rag, ragc, ug. |
raModel(ctx context.Context) |
Creates the ra (Resource Access) system model with name and key fields. |
rasModel(ctx context.Context) |
Creates the ras (Resource Access Section) system model with name and key fields. |
ragModel(ctx context.Context) |
Creates the rag (Resource Access Group) system model with name and key fields. |
ragcModel(ctx context.Context, config *mdl.ProjectConfig) |
Creates the ragc (Resource Access Group Control) system model with one-to-many relations to ra and rag. |
ugModel(ctx context.Context, config *mdl.ProjectConfig) |
Creates the ug (User Group) system model with one-to-many relations to user and ragc. |
userModel(ctx context.Context, config *mdl.ProjectConfig) |
Creates the user model (CRUD enabled) with name, email, timezone, and locale string fields. Sets Is = "user". |
db(ctx context.Context, project *mdl.Project) |
Creates a Db record for the project with Regenerate: true and Populate: true. |
webCommand(ctx context.Context) |
Creates a WebCommand service (kind Command) and its associated web command record (is CommandIsWeb). |
trayCommand(ctx context.Context) |
Creates a TrayCommand service (kind Command) and its associated tray command record (is CommandIsTray). |
configureHomeView(ctx context.Context) |
Fetches the HomeView service by name and adds title, welcome, and grid sections to it. |
addTitleSection(ctx context.Context, has bool, homeView *mdl.Service) |
Adds a TitleSection GOC section with a plain <section> wrapper, a flex justify-between class, and an h1 DS item labelled “Home”. |
addWelcomeSection(ctx context.Context, has bool, homeView *mdl.Service) |
Adds a WelcomeSection GOC section containing a plain <section> item. |
addGridSection(ctx context.Context, has bool, homeView *mdl.Service) |
Creates a GridSection GOC section service and marks its sub-kind as ServiceSubKindSectionHomeGrid. |
markHtmlViewAsIsHtmlView(ctx context.Context) |
Fetches HomeView by name and sets Is = ServiceIsHomeView, then persists the update. |
addAppRouteForHomeView(ctx context.Context, actorId string) *mdl.Service |
Creates the GET / app route service for the home actor, adds an app binder, and returns the created service. |
miscRoutes(ctx context.Context) |
Registers eight miscellaneous route services: PingMiscRoute, OpenapiMiscRoute, RootMiscRoute, DevConfigureMiscRoute, OpenFileMiscRoute, AppLoginMiscRoute, FollowOpMiscRoute, DisplayOpMiscRoute. |
configureSetupServices(ctx context.Context, config *mdl.ProjectConfig) |
Builds the ServiceDataGinRouter by collecting IDs from Misc, Auth (if configured), App, Ajx, and optionally Api routers, then writes the data back to the GinRouter service. |
addRouterIntoData(ctx context.Context, d *dat.ServiceDataGinRouter, is string) |
Finds a service by its Is identifier within the project scope and appends its ID to d.RouterIds. |
addDependencies(ctx context.Context, config *mdl.ProjectConfig) |
Creates Dependency records for all standard Go module dependencies: gin-jwt, clock, chromedp, cdproto, gin-contrib/sessions, gin, go-sqlite3, afero, and kitcla. |
setSyncId(ctx context.Context, config *mdl.ProjectConfig) |
If config.SyncId is empty, generates a new UUID and saves it on the project config. |
retrieveProjectConfig(ctx context.Context, project *mdl.Project) (*mdl.ProjectConfig, error) |
Finds the existing ProjectConfig for the project, or creates one with default values (package name, paths under /tmp/gen-output/<name>, REST API and migration disabled, web port 8086, debug port 9620). |
addTray(ctx context.Context, config *mdl.ProjectConfig) |
If ProjectConfigData.Tray is true, adds the fyne.io/systray dependency and calls trayCommand. |
addDepiction(ctx context.Context, project *mdl.Project) |
Calls Depictor.Act for projects that have Depicting: true. |
AddModel(ctx context.Context, config *mdl.ProjectConfig, name string, crud bool) *mdl.Model |
Creates and applies a model by name, returning the persisted Model. Convenience method used internally and externally by tools like the exchange router. |
AddModelField(ctx context.Context, config *mdl.ProjectConfig, modelField *mdl.ModelField, model *mdl.Model) *mdl.ModelField |
Assigns the model ID, creates and applies the field, then reloads it from the database. Returns the up-to-date ModelField. |
AddOneToManyModelRelation(ctx context.Context, config *mdl.ProjectConfig, fromModel *mdl.Model, toModelName string) |
Looks up the target model by name, creates a <to>_id relation-ID field on fromModel, then creates and applies both the owner (kind One) and reverse (kind Many) ModelRelation records to form a bidirectional one-to-many association. |
Next Steps
- Handler — understand the write layer that appliers depend on to persist entities
- Fetcher — see how fetchers retrieve the entities that appliers then cascade side-effects over
- Hydrator — control which associations are loaded when fetchers are called from within appliers
- Serializers — learn how persisted entities are serialized for API responses after appliers complete