Documentation
¶
Overview ¶
Package convert holds small generic adapters between the ogen-generated Opt*/OptNil* option types and the plain Go pointers that ent setters expect. They replace the per-package optNil* helpers that the site and external API handlers previously duplicated.
Index ¶
- func DocJSON[M ~map[string]jx.Raw](fields M, set bool) json.RawMessage
- func DocObject[M ~map[string]jx.Raw](doc json.RawMessage) M
- func Int64Ptr[T ~int64, O getter[T]](o O) *int64
- func Ptr[T any, O getter[T]](o O) *T
- func RawMap[M ~map[string]jx.Raw](m M) map[string]any
- func StringPtr[T ~string, O getter[T]](o O) *string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DocJSON ¶
DocJSON is the opaque editor-document object of a write as the JSON the modules render; nil when the request names none. An empty object is a document (an invalid one), not an absent one.
func DocObject ¶
func DocObject[M ~map[string]jx.Raw](doc json.RawMessage) M
DocObject is a stored editor document as the opaque object of a contract; nil for a message written as HTML, which has none.
func Int64Ptr ¶
Int64Ptr is like Ptr but coerces named int64 option values (e.g. an EntityId) down to *int64, the type ent's Nillable setters take.
func Ptr ¶
func Ptr[T any, O getter[T]](o O) *T
Ptr returns a pointer to the option's value, or nil when it is unset/null.
Types ¶
This section is empty.