From 4d17146a25ec4612e2bcbfb9a4bb48a809f243b5 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Sep 2026 20:46:21 +0800 Subject: [PATCH] =?UTF-8?q?chore=F0=9F=94=A7:=20deprecate=20the=20five=20C?= =?UTF-8?q?RUD=20actions=20the=20generic=20ones=20replace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IndexAction, ViewAction, CreateAction, UpdateAction and DeleteAction stay and behave as before; each now points at its generic replacement. Nothing in this repository calls them any more. --- common/actions/create.go | 4 ++++ common/actions/delete.go | 4 ++++ common/actions/index.go | 4 ++++ common/actions/update.go | 4 ++++ common/actions/view.go | 5 +++++ 5 files changed, 21 insertions(+) diff --git a/common/actions/create.go b/common/actions/create.go index 9fe75bd7..abaf57d5 100644 --- a/common/actions/create.go +++ b/common/actions/create.go @@ -14,6 +14,10 @@ import ( ) // CreateAction 通用新增动作 +// +// Deprecated: Use Create[Model, Control](). It builds its values per request, so the +// Generate() copies this action depends on are not needed, and a model +// paired with the wrong request does not compile. See generic.go. func CreateAction(control dto.Control) gin.HandlerFunc { return func(c *gin.Context) { log := api.GetRequestLogger(c) diff --git a/common/actions/delete.go b/common/actions/delete.go index 530ec997..444fb690 100644 --- a/common/actions/delete.go +++ b/common/actions/delete.go @@ -14,6 +14,10 @@ import ( ) // DeleteAction 通用删除动作 +// +// Deprecated: Use Delete[Model, ById](). It builds its values per request, so the +// Generate() copies this action depends on are not needed, and a model +// paired with the wrong request does not compile. See generic.go. func DeleteAction(control dto.Control) gin.HandlerFunc { return func(c *gin.Context) { db, err := pkg.GetOrm(c) diff --git a/common/actions/index.go b/common/actions/index.go index eb9afb40..fa7a5c66 100644 --- a/common/actions/index.go +++ b/common/actions/index.go @@ -15,6 +15,10 @@ import ( ) // IndexAction 通用查询动作 +// +// Deprecated: Use Index[Model, Search](). It builds its values per request, so the +// Generate() copies this action depends on are not needed, and a model +// paired with the wrong request does not compile. See generic.go. func IndexAction(m models.ActiveRecord, d dto.Index, f func() interface{}) gin.HandlerFunc { return func(c *gin.Context) { db, err := pkg.GetOrm(c) diff --git a/common/actions/update.go b/common/actions/update.go index 3ce96d07..6e849813 100644 --- a/common/actions/update.go +++ b/common/actions/update.go @@ -14,6 +14,10 @@ import ( ) // UpdateAction 通用更新动作 +// +// Deprecated: Use Update[Model, Control](). It builds its values per request, so the +// Generate() copies this action depends on are not needed, and a model +// paired with the wrong request does not compile. See generic.go. func UpdateAction(control dto.Control) gin.HandlerFunc { return func(c *gin.Context) { db, err := pkg.GetOrm(c) diff --git a/common/actions/view.go b/common/actions/view.go index 3f3a0f2f..60480f8c 100644 --- a/common/actions/view.go +++ b/common/actions/view.go @@ -15,6 +15,11 @@ import ( ) // ViewAction 通用详情动作 +// +// Deprecated: Use View[Model, ById](), or ViewAs[Model, ById, Response]() +// where f returned another type. It builds its values per request, so the +// Generate() copies this action depends on are not needed, and a model +// paired with the wrong request does not compile. See generic.go. func ViewAction(control dto.Control, f func() interface{}) gin.HandlerFunc { return func(c *gin.Context) { db, err := pkg.GetOrm(c)