unions

package
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(tree interface{}) error

Normalize allows normalizing all the unions encountered while walking through the whole struct tree. Union normalizing works according to the following rules: - When only one field of the union is set and no discriminator is set, set the discriminator according to the union value. - When several fields are set and a discriminator is set, remove (== reset to zero value) all the values that do not match the discriminator. - When only one union value is set and it matches discriminator, just do nothing. - In other case, something is inconsistent or ambiguous: an error is thrown.

func Simplify

func Simplify(tree interface{}) error

Simplify allows removing the discriminator of all unions encountered while walking through the whole struct tree, but after normalizing them if necessary.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL