github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/types/jsonlines/jsonlines.go (about)

     1  package jsonlines
     2  
     3  import (
     4  	"github.com/lmorg/murex/lang"
     5  	"github.com/lmorg/murex/lang/stdio"
     6  	"github.com/lmorg/murex/lang/types"
     7  )
     8  
     9  func init() {
    10  	// Register data type
    11  	lang.Marshallers[types.JsonLines] = marshal
    12  	lang.Unmarshallers[types.JsonLines] = unmarshal
    13  	lang.ReadIndexes[types.JsonLines] = index
    14  	lang.ReadNotIndexes[types.JsonLines] = index
    15  
    16  	stdio.RegisterReadArray(types.JsonLines, readArray)
    17  	stdio.RegisterReadArrayWithType(types.JsonLines, readArrayWithType)
    18  	//stdio.RegisterReadMap(name, readMap)
    19  	stdio.RegisterWriteArray(types.JsonLines, newArrayWriter)
    20  
    21  	lang.SetMime(types.JsonLines,
    22  		"application/jsonl",
    23  		"application/x-jsonl",
    24  		"text/jsonl",
    25  		"text/x-jsonl",
    26  
    27  		"application/jsonlines",
    28  		"application/x-jsonlines",
    29  		"text/jsonlines",
    30  		"text/x-jsonlines",
    31  
    32  		"application/json-lines",
    33  		"application/x-json-lines",
    34  		"text/json-lines",
    35  		"text/x-json-lines",
    36  
    37  		"application/ldjson",
    38  		"application/x-ldjson",
    39  		"text/ldjson",
    40  		"text/x-ldjson",
    41  
    42  		"application/ndjson",
    43  		"application/x-ndjson",
    44  		"text/ndjson",
    45  		"text/x-ndjson",
    46  	)
    47  
    48  	lang.SetFileExtensions(types.JsonLines,
    49  		"jsonl",
    50  		"jsonlines",
    51  		"json-lines",
    52  		"ldjson",
    53  		"ndjson",
    54  		"murex_history",
    55  	)
    56  }