Celixir.Proto.Codec (Celixir v0.3.0)

Copy Markdown View Source

Protobuf binary codec for Any type support.

This module is only compiled when the protobuf library is available. It provides encode/decode functions for converting between CEL struct representations and protobuf binary format, enabling google.protobuf.Any pack/unpack operations.

Summary

Functions

Returns true if the protobuf codec is available.

Decode protobuf binary to a CEL struct value.

Encode a CEL struct value to protobuf binary format.

Get the fully-qualified protobuf name from a compiled module.

Pack a CEL struct into a google.protobuf.Any representation.

Resolve a CEL type name to a compiled protobuf module.

Extract the fully-qualified type name from a type_url.

Unpack a google.protobuf.Any to its contained CEL struct.

Functions

available?()

Returns true if the protobuf codec is available.

decode(type_url, binary)

Decode protobuf binary to a CEL struct value.

Takes a type_url and binary value, resolves the protobuf module, and decodes to a {:cel_struct, type_name, fields} tuple.

encode(type_name, fields)

Encode a CEL struct value to protobuf binary format.

Takes a CEL type name and fields map, resolves the protobuf module, and encodes to binary wire format.

module_full_name(mod)

Get the fully-qualified protobuf name from a compiled module.

pack(type_name, fields)

Pack a CEL struct into a google.protobuf.Any representation.

Returns {:cel_struct, "google.protobuf.Any", %{"type_url" => ..., "value" => ...}}.

resolve_module(type_name)

Resolve a CEL type name to a compiled protobuf module.

type_name_from_url(type_url)

Extract the fully-qualified type name from a type_url.

unpack(arg1)

Unpack a google.protobuf.Any to its contained CEL struct.