CustomMap

io.github.srs.config.yaml.parser.collection.CustomMap
object CustomMap

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
CustomMap.type

Members list

Extensions

Extensions

extension (map: Map[String, Any])
def getOptionalSubMap(key: String): ConfigResult[Option[Map[String, Any]]]

Retrieves an optional sub-map from the given map by key.

Retrieves an optional sub-map from the given map by key.

Value parameters

key

the key to look for in the map

Attributes

Returns

a ConfigResult containing an Option[Map[String, Any]]. If the key is present it returns Right(Some(subMap)), if the key is missing it returns Right(None), and if there's an error it returns Left(errors).

def getSubMap(key: String): ConfigResult[Map[String, Any]]

Retrieves a sub-map from the given map by key.

Retrieves a sub-map from the given map by key.

Value parameters

key

the key to look for in the map

Attributes

Returns

a ConfigResult containing the sub-map. If the key is present and the value is a map, it returns Right(subMap), if the key is missing it returns Left(errors) with a ConfigError.MissingField, and if the value is not a map it returns Left(errors) with a ConfigError.InvalidType

def parseSequence[A](key: String, parseFunc: Map[String, Any] => ConfigResult[A]): ConfigResult[Seq[A]]

Parses a sequence of elements from the map using a provided parsing function.

Parses a sequence of elements from the map using a provided parsing function.

Type parameters

A

the type of elements in the sequence

Value parameters

key

the key to look for in the map

parseFunc

a function that takes a Map[String, Any] and returns a ConfigResult[A]

Attributes

Returns

a ConfigResult[Seq[A]] containing the parsed sequence. If the key is present and the value is a list of maps, it applies the parseFunc to each element. If the key is missing, it returns an empty sequence. If the value is not a list of maps, it returns a Left with a ConfigError.InvalidType.