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

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