add function to apply mutations over grpc
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 41s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m50s

This commit is contained in:
matst80
2025-11-28 14:07:43 +01:00
parent 2c0f6c160a
commit 47e69f18a5
12 changed files with 1015 additions and 74 deletions

View File

@@ -212,9 +212,9 @@ func (r *ProtoMutationRegistry) Apply(ctx context.Context, grain any, msg ...pro
}
for _, m := range msg {
// Ignore nil mutation elements (untyped or typed nil pointers) silently; they carry no data.
// Error if any mutation element is nil.
if m == nil {
continue
return results, fmt.Errorf("nil mutation message")
}
// Typed nil: interface holds concrete proto message type whose pointer value is nil.
rv := reflect.ValueOf(m)
@@ -251,6 +251,12 @@ func (r *ProtoMutationRegistry) Apply(ctx context.Context, grain any, msg ...pro
}
}
}
// Return error for unregistered mutations
for _, res := range results {
if res.Error == ErrMutationNotRegistered {
return results, res.Error
}
}
return results, nil
}