DynamicWriteStrategy

When an object registered as a dynamic type is written as one without being asked to be.

This governs the write side only. Reading needs no policy: a value comes back as a dynamic_dto because the column is one, and the discriminator inside it names the class - neither of which depends on what the calling code declared.

Writing has no such anchor. The driver declares the types of the parameters it sends rather than asking the server what it wants, so at a top-level parameter there is no expected type to consult and the Kotlin class is the only thing to go on. Where a class is registered here and as a composite, that is not enough to say which of the two was meant, and this is what settles it.

DynamicTypes.toDynamicDto overrides whichever mode is in force: a value already wrapped is written as a dynamic_dto under all three.

A mode is given to a client, but what enforces it is a converter on the driver's type registry, and that registry is global to the database. Two clients on one database therefore do not hold a mode each: the one that registered a dynamic type last is the one whose mode applies to both. Where an application builds a second client against the same database - a read-only pool, a test harness - give it the same mode.

Entries

Link copied to clipboard

Only a value wrapped in DynamicTypes.toDynamicDto is written as a dynamic_dto.

Link copied to clipboard

A registered class is written as a dynamic_dto unless it is also a registered composite, in which case the composite takes it and wrapping is how you ask for the other.

Link copied to clipboard

A registered class is written as a dynamic_dto even where it is also a registered composite.

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.