VCF.Field (VCF v1.0.0)

View Source

An ordered INFO or sample FORMAT field.

Fields remain lists so ordering and duplicate source entries are retained.

iex> fields = [%VCF.Field{key: "DP", value: 8}, %VCF.Field{key: "DP", value: 9}]
iex> VCF.Field.get(fields, "DP")
8
iex> VCF.Field.get_all(fields, "DP")
[8, 9]

Summary

Functions

Fetches the first value for key.

Returns the first value for key, or default when it is absent.

Returns all values for key in source order.

Types

t()

@type t() :: %VCF.Field{key: String.t(), raw: String.t() | nil, value: term()}

Functions

fetch(fields, key)

@spec fetch([t()], String.t()) :: {:ok, term()} | :error

Fetches the first value for key.

get(fields, key, default \\ nil)

@spec get([t()], String.t(), term()) :: term()

Returns the first value for key, or default when it is absent.

get_all(fields, key)

@spec get_all([t()], String.t()) :: [term()]

Returns all values for key in source order.