dig

Types

wrap dynamic.Decoder with a path

pub type DigDecoder {
  DigObject(path: List(String), inner: Decoder(Dynamic))
  DigList(path: List(String), inner: Decoder(List(Dynamic)))
}

Constructors

  • DigObject(path: List(String), inner: Decoder(Dynamic))
  • DigList(path: List(String), inner: Decoder(List(Dynamic)))
pub type DigError {
  EmptyPath
  ParsePath(inner: PathSegParseError)
}

Constructors

  • EmptyPath
  • ParsePath(inner: PathSegParseError)

Ok(DigDecoder) or Error(DigError)

pub type DigResult =
  Result(DigDecoder, DigError)
pub type PathSeg {
  Object(key: String)
  List(key: Option(String), index: Option(Int))
}

Constructors

  • Object(key: String)
  • List(key: Option(String), index: Option(Int))
pub type PathSegParseError {
  InvalidPathSeg(path_seg: String)
}

Constructors

  • InvalidPathSeg(path_seg: String)
pub type PathSegParseResult =
  Result(PathSeg, PathSegParseError)

Functions

pub fn compose(a: DigDecoder, b: DigDecoder) -> DigDecoder

compose two DigDecoders

pub fn dig(path: List(String)) -> Result(DigDecoder, DigError)

dig dynamic.Encoder in path

pub fn dig_path_seg(
  path_seg: String,
) -> Result(DigDecoder, DigError)

dig dynamic.Decoder in single path segment

pub fn parse_path_seg(
  path_seg: String,
) -> Result(PathSeg, PathSegParseError)

parse single path segment

Search Document