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

     1  package csvbad
     2  
     3  import (
     4  	"github.com/lmorg/murex/lang"
     5  	"github.com/lmorg/murex/lang/stdio"
     6  )
     7  
     8  const typeName = "csvbad"
     9  
    10  func init() {
    11  	//stdio.RegisterReadArray(typeName, readArray)
    12  	stdio.RegisterReadMap(typeName, readMap)
    13  
    14  	lang.ReadIndexes[typeName] = readIndex
    15  	lang.ReadNotIndexes[typeName] = readIndex
    16  
    17  	lang.Marshallers[typeName] = marshal
    18  	lang.Unmarshallers[typeName] = unmarshal
    19  
    20  	// The following syntax is defined in the `csv` type.
    21  	// Uncomment it if - for whatever reason - you want to disable the default
    22  	// CSV marshaller. You may also want to change the `typeName` const (above)
    23  	// to just `csv`.
    24  	/*
    25  		// `application/csv` and `text/csv` are the common ones. `x-csv` is added just in case anyone decides to use
    26  		// something non-standard.
    27  		lang.SetMime(typeName,
    28  			"application/csv",
    29  			"application/x-csv",
    30  			"text/csv",
    31  			"text/x-csv",
    32  		)
    33  
    34  		//lang.SetFileExtensions(typeName, "csv")
    35  
    36  		lang.InitConf.Define("csv", "separator", config.Properties{
    37  			Description: "The delimiter for records in a CSV file.",
    38  			Default:     `,`,
    39  			DataType:    types.String,
    40  		})
    41  
    42  		lang.InitConf.Define("csv", "comment", config.Properties{
    43  			Description: "The prefix token for comments in a CSV table.",
    44  			Default:     `#`,
    45  			DataType:    types.String,
    46  		})
    47  
    48  		lang.InitConf.Define("csv", "headings", config.Properties{
    49  			Description: "CSV files include headings when queried in formap.",
    50  			Default:     true,
    51  			DataType:    types.Boolean,
    52  		})
    53  	*/
    54  }