github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/types/jsonconcat/json.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.Json] = marshal
    15  	lang.Unmarshallers[types.Json] = unmarshal
    16  	lang.ReadIndexes[types.Json] = index
    17  	lang.ReadNotIndexes[types.Json] = index
    18  
    19  	stdio.RegisterReadArray(types.Json, readArray)
    20  	stdio.RegisterReadArrayWithType(types.Json, readArrayWithType)
    21  	stdio.RegisterReadMap(types.Json, readMap)
    22  	stdio.RegisterWriteArray(types.Json, newArrayWriter)
    23  
    24  	lang.SetMime(types.Json,
    25  		"application/json", // this is preferred, but we include the others incase a website sends a non-standard MIME time
    26  		"application/x-json",
    27  		"text/json",
    28  		"text/x-json",
    29  	)
    30  	lang.SetFileExtensions(types.Json, "json", "tfstate")
    31  }