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)