yodel/properties

Types

pub type Path =
  String
pub opaque type Properties
pub type PropertiesError {
  PathNotFound(path: String)
  TypeError(path: String, error: TypeError)
}

Constructors

  • PathNotFound(path: String)
  • TypeError(path: String, error: TypeError)
pub type TypeError {
  ExpectedString(got: Value)
  ExpectedInt(got: Value)
  ExpectedFloat(got: Value)
  ExpectedBool(got: Value)
}

Constructors

  • ExpectedString(got: Value)
  • ExpectedInt(got: Value)
  • ExpectedFloat(got: Value)
  • ExpectedBool(got: Value)
pub type Value {
  StringValue(String)
  IntValue(Int)
  FloatValue(Float)
  BoolValue(Bool)
  NullValue
}

Constructors

  • StringValue(String)
  • IntValue(Int)
  • FloatValue(Float)
  • BoolValue(Bool)
  • NullValue

Functions

pub fn bool(
  for path: List(PathSegment),
  value value: Bool,
) -> Properties
pub fn delete(
  from props: Properties,
  delete path: List(PathSegment),
) -> Properties
pub fn float(
  for path: List(PathSegment),
  value value: Float,
) -> Properties
pub fn fold(
  over props: Properties,
  from initial: a,
  with fun: fn(a, String, Value) -> a,
) -> a
pub fn get(
  from props: Properties,
  get path: String,
) -> Result(Value, PropertiesError)
pub fn insert(
  into props: Properties,
  for path: String,
  insert value: Value,
) -> Properties
pub fn insert_bool(
  into props: Properties,
  for path: String,
  insert value: Bool,
) -> Properties
pub fn insert_float(
  into props: Properties,
  for path: String,
  insert value: Float,
) -> Properties
pub fn insert_int(
  into props: Properties,
  for path: String,
  insert value: Int,
) -> Properties
pub fn insert_null(
  into props: Properties,
  for path: String,
) -> Properties
pub fn insert_string(
  into props: Properties,
  for path: String,
  insert value: String,
) -> Properties
pub fn int(
  for path: List(PathSegment),
  value value: Int,
) -> Properties
pub fn merge(
  into old_props: Properties,
  from new_props: Properties,
) -> Properties
pub fn new() -> Properties
pub fn null(for path: List(PathSegment)) -> Properties
pub fn size(of props: Properties) -> Int
pub fn string(
  for path: List(PathSegment),
  value value: String,
) -> Properties
Search Document