View Source Avrogen.Avro.Types.Logical.Decimal (avrogen v0.7.1)

This represents the logical type of the decimal in the specification

The decimal logical type represents an arbitrary-precision signed decimal number of the form unscaled × 10-scale.

Officially this typs can be either bytes or fixed, currently I have not added support for fixed.

The following attributes are supported:

  • scale, a JSON integer representing the scale (optional). If not specified the scale is 0.
  • precision, a JSON integer representing the (maximum) precision of decimals stored in this type (required).

Precision must be a positive integer greater than zero. If the underlying type is a fixed, then the precision is limited by its size. An array of length n can store at most floor(log_10(28 × n - 1 - 1)) base-10 digits of precision.

Scale must be zero or a positive integer less than or equal to the precision.

For the purposes of schema resolution, two schemas that are decimal logical types match if their scales and precisions match.

Summary

Types

@type t() :: %Avrogen.Avro.Types.Logical.Decimal{
  logicalType: String.t() | nil,
  precision: integer(),
  scale: integer(),
  type: String.t() | nil
}

Functions