Open
Description
resource.TypedStore
(and resource.Store
) does not support Patch operations, in this case by design to imitate a KV store interface where the only option for updating is to replace an object (and Patch can have a few gotchas involved). However, users find it useful to be able to do patch operations from a typed interface like resource.TypedStore
. We should evaluate either adding Patch support to the stores, or introducing something like resource.TypedClient
which wraps resource.Client
like so:
type TypedClient[T Object, L ListObject] struct {
Client Client
}
func (t *TypedClient[T,L]) Get(ctx context.Context, identifier Identifier) (T, error) {
obj, err := t.client.Get(ctx, identifier)
if err != nil {
var n T
return n, err
}
return t.castObject(obj)
}
// ...etc. for all other Client methods