Generic functions used to implement the database.Store methods. insert runs an policy.ActionCreate on the rbac object argument before running the insertFunc. The insertFunc is expected to return the object that was inserted.
( logger slog.Logger, authorizer rbac.Authorizer, object rbac.Objecter, insertFunc Insert, )
| 906 | // running the insertFunc. The insertFunc is expected to return the object that |
| 907 | // was inserted. |
| 908 | func insert[ |
| 909 | ObjectType any, |
| 910 | ArgumentType any, |
| 911 | Insert func(ctx context.Context, arg ArgumentType) (ObjectType, error), |
| 912 | ]( |
| 913 | logger slog.Logger, |
| 914 | authorizer rbac.Authorizer, |
| 915 | object rbac.Objecter, |
| 916 | insertFunc Insert, |
| 917 | ) Insert { |
| 918 | return insertWithAction(logger, authorizer, object, policy.ActionCreate, insertFunc) |
| 919 | } |
| 920 | |
| 921 | func insertWithAction[ |
| 922 | ObjectType any, |