ReadMap() (type) - API Reference

Treat data type as a key/value structure and read its contents


This is a function you would write when programming a Murex data-type.

It’s called by builtins to allow them to read data structures one key/value pair at a time.

The purpose of this function is to allow builtins to support sequential reads (where possible) and also create a standard interface for builtins, thus allowing them to be data-type agnostic.


Registering your ReadMap()

// To avoid confusion, this should only happen inside func init()
stdio.RegisterReadMap(/* your type name */, /* your readMap func */)


Example ReadMap() function:

package json

import (

func readMap(read stdio.Io, _ *config.Config, callback func(*stdio.Map)) error {
    // Create a marshaller function to pass to ArrayWithTypeTemplate
    marshaller := func(v interface{}) ([]byte, error) {
        return json.Marshal(v, read.IsTTY())

    return lang.MapTemplate(types.Json, marshaller, json.Unmarshal, read, callback)


There isn’t (yet) a template read function for types to call. However that might follow in a future release of Murex.


  1. stdio.Io: stream to read from (eg STDIN)
  2. *config.Config: scoped config (eg your data type might have configurable parsing rules)
  3. func(key, value string, last bool): callback function: key and value of map plus boolean which is true if last element in row (eg reading from tables rather than key/values)

See Also

This site's content is rebuilt automatically from murex's source code after each merge to the master branch. Downloadable murex binaries are also built with the website.

Last built on Fri May 19 22:45:48 UTC 2023 against commit 54b5f6754b5f67b250bbf7353e83c42ed187802584c3ae3.

Current version is 4.1.6140 which has been verified against 14045 tests cases.