task

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Code generated by gombit make resource. DO NOT EDIT.

Code generated by gombit make resource. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(app *framework.App)

Register mounts task Huma routes, wiring the human-owned Hooks.

func RegisterAdmin

func RegisterAdmin(app *framework.App) error

RegisterAdmin registers Task on the runtime admin. Feature packages own this call — the framework never discovers GORM models by itself (ADR-013).

Register requires cookie auth; it returns an error under Bearer-only mode.

Types

type Handler

type Handler struct {
	DB    *gorm.DB
	Hooks TaskHooks
}

Handler serves Task HTTP operations over GORM. Register wires DB and Hooks.

type Hooks added in v0.2.0

type Hooks struct{}

Hooks implements TaskHooks. This file is generated once and is yours to edit: set server-managed columns (tenant, owner, timestamps not handled by GORM, …) on row in BeforeCreate. Regeneration does not overwrite it.

func (Hooks) BeforeCreate added in v0.2.0

func (Hooks) BeforeCreate(ctx context.Context, row *Task, body taskCreateBody) error

BeforeCreate runs after the request is mapped onto row and before it is persisted. The default is a no-op; add server-derived values here.

type Task

type Task struct {
	ID        uint `gorm:"primaryKey" json:"id"`
	CreatedAt time.Time
	UpdatedAt time.Time
	Title     string `gorm:"size:255;not null"`
	Done      bool
}

Task is the tutorial's feature-package GORM model — the human-owned source of truth, exactly as `gombit make resource Task title:string:required done:bool` scaffolds it (model-first: no "do not edit" banner). The request/response DTOs and CRUD handler are derived from it into the committed dto.gen.go / handler.gen.go, which TestGeneratedFilesAreFresh re-derives and byte-compares so this model and its generated files never drift. It has no soft-delete DeletedAt: Gombit deletes rows physically (ADR-019).

type TaskHooks added in v0.2.0

type TaskHooks interface {
	BeforeCreate(ctx context.Context, row *Task, body taskCreateBody) error
}

TaskHooks are the customization points for the generated Task handler. The generated handler owns the invariant CRUD sequence and calls these; set server-managed columns (tenant, owner, …) in BeforeCreate rather than editing generated plumbing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL