Files
go-admin/common
zhangwenjian 024dd047ae feat✨: add generic CRUD actions
Index, View, ViewAs, Create, Update and Delete take the model and the
request as type parameters. They serve the same routes as IndexAction
and its siblings and answer them the same way; what they drop is what
the caller had to get right.

The older actions serve every request from instances passed at
registration, so each model and request type needs a Generate that
returns a copy, and a list route takes a func() interface{} whose
element type nothing checks. Here every request declares its own
values, and a model paired with the wrong request does not compile.
ViewAs answers a detail route with a type other than the model, as
ViewAction's f did.

Beyond that they differ in three places, all where the older ones were
wrong: a request with no database is answered with 500 instead of an
empty 200; the key is matched against the primary-key column as a
value, not handed to Where, which reads a string as SQL; and there is
no GenerateM whose error could be dropped.

A test runs the old and new actions on the same types through one
request script and requires every response to match.
2026-09-27 20:46:01 +08:00
..
2026-09-27 20:46:01 +08:00
2026-08-23 13:26:46 +08:00
2026-09-18 18:55:19 +08:00
2023-08-01 22:38:41 +08:00
2026-08-23 13:26:46 +08:00