gamqp/amqp091/table

AMQP field tables, used for arguments, headers and broker properties.

Type tags follow RabbitMQ’s dialect of AMQP 0-9-1 (the spec’s errata), which is what every mainstream broker and client speaks.

Types

pub type FieldValue {
  Bool(Bool)
  Int8(Int)
  UInt8(Int)
  Int16(Int)
  UInt16(Int)
  Int32(Int)
  UInt32(Int)
  Int64(Int)
  Float32(Float)
  Float64(Float)
  Decimal(scale: Int, value: Int)
  LongString(String)
  Bytes(BitArray)
  Array(List(FieldValue))
  Timestamp(Int)
  Table(List(#(String, FieldValue)))
  Void
}

Constructors

  • Bool(Bool)
  • Int8(Int)
  • UInt8(Int)
  • Int16(Int)
  • UInt16(Int)
  • Int32(Int)
  • UInt32(Int)
  • Int64(Int)
  • Float32(Float)
  • Float64(Float)
  • Decimal(scale: Int, value: Int)

    value scaled down by 10^scale.

  • LongString(String)
  • Bytes(BitArray)

    A long string whose bytes are not valid UTF-8, or the x byte array type.

  • Array(List(FieldValue))
  • Timestamp(Int)

    Seconds since the Unix epoch.

  • Table(List(#(String, FieldValue)))
  • Void

An ordered list of named values. Order is preserved on the wire.

pub type Table =
  List(#(String, FieldValue))

Values

pub fn get(
  table: List(#(String, FieldValue)),
  key: String,
) -> Result(FieldValue, Nil)

Returns the first value stored under key.

pub fn put(
  table: List(#(String, FieldValue)),
  key: String,
  value: FieldValue,
) -> List(#(String, FieldValue))

Replaces the value stored under key, appending it when absent.

✨ Search Document