chore🔧: deprecate the five CRUD actions the generic ones replace

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.
This commit is contained in:
zhangwenjian
2026-09-27 20:46:21 +08:00
parent fda94c4965
commit 4d17146a25
5 changed files with 21 additions and 0 deletions
+4
View File
@@ -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)
+4
View File
@@ -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)
+4
View File
@@ -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)
+4
View File
@@ -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)
+5
View File
@@ -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)