Skip to content

Conversation

@DelSkayn
Copy link
Member

@DelSkayn DelSkayn commented Aug 21, 2024

Overhauls the derive macro to better support removing fields in a enum variant and removing the fields of types which are no longer used in the latest revision.

This PR introduces field structs for enum variants.
When a field is removed from an enum variant, the convert function now looks like fn(&mut FieldStruct,revision: u16, value: T) -> Result<()> where FieldStruct is a generated struct which has the same fields as the variant has at the current revision.
Furthermore when a variant is removed the convert function now takes this field struct as an argument.

This PR also introduces an option to override the default generated discriminant values for enum variants. This is useful for compatibility with previous versions of revision which had different behavior.

@DelSkayn DelSkayn force-pushed the refactor-derive-logic branch from d29b888 to 8cdb4b3 Compare August 23, 2024 09:20
@DelSkayn DelSkayn mentioned this pull request Aug 23, 2024
@tobiemh tobiemh merged commit 486fd91 into surrealdb:main Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants