package ocaml-protoc-plugin

  1. Overview
  2. Docs

A single field of a message type.

module Kind : sig ... end

Basic field types.

module Cardinality : sig ... end

Whether a field is optional, required, or repeated.

type t = {
  1. kind : Kind.t;
    (*

    The field type.

    *)
  2. cardinality : Cardinality.t;
    (*

    The field cardinality.

    *)
  3. number : int;
    (*

    The field number.

    *)
  4. name : string;
    (*

    The field name.

    *)
  5. type_url : string;
    (*

    The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.

    *)
  6. oneof_index : int;
    (*

    The index of the field type in `Type.oneofs`, for message or enumeration types. The first type has index 1; zero means the type is not in the list.

    *)
  7. packed : bool;
    (*

    Whether to use alternative packed wire representation.

    *)
  8. options : Option.t list;
    (*

    The protocol buffer options.

    *)
  9. json_name : string;
    (*

    The field JSON name.

    *)
  10. default_value : string;
    (*

    The string value of the default value of this field. Proto2 syntax only.

    *)
}
val make : ?kind:Kind.t -> ?cardinality:Cardinality.t -> ?number:int -> ?name:string -> ?type_url:string -> ?oneof_index:int -> ?packed:bool -> ?options:Option.t list -> ?json_name:string -> ?default_value:string -> unit -> t

Helper function to generate a message using default values

Serialize the message to binary format

val from_proto : Ocaml_protoc_plugin.Reader.t -> (t, [> Ocaml_protoc_plugin.Result.error ]) Stdlib.result

Deserialize from binary format

Serialize to Json (compatible with Yojson.Basic.t)

val from_json : Ocaml_protoc_plugin.Json.t -> (t, [> Ocaml_protoc_plugin.Result.error ]) Stdlib.result

Deserialize from Json (compatible with Yojson.Basic.t)

val name : unit -> string

Fully qualified protobuf name of this message

OCaml

Innovation. Community. Security.