Open
Description
Is your feature request related to a problem?
Sometimes we need to allow the field names to be configured during runtime.
Describe the solution
A simple and flexible approach is to support using Map
as the content input, which not only solves the problem but also avoids the use of reflection.
Alternative methods
Basically as follows:
private static <T> ValueMut convertObject(final T object) {
...
// if object instanceof Map<?, ?>
final List<EntryMut> entries = new ArrayList<>(map.size());
for (Map.Entry<?, ?> entry : map.entrySet()) {
Object key = entry.getKey();
Object value = entry.getValue();
final String name = key.toString();
final ValueMut valueMut = convert(field.get(object));
if (valueMut != null) {
entries.add(EntryMut.newEntry(name, valueMut ));
}
}
}
SurrealDB version
any
Contact Details
No response
Is there an existing issue for this?
- I have searched the existing issues
Code of Conduct
- I agree to follow this project's Code of Conduct