parser

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 12 Imported by: 2 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CsvInterface

type CsvInterface interface {
	SetOptionsRead(opt CsvOptions)
	SetOptionsWrite(opt CsvOptions)
	Marshal(orig interface{}) ([]byte, error)
	MarshalWithoutHeaders(orig interface{}) ([]byte, error)
	Unmarshal(blob []byte, dest interface{}) error
}

type CsvOptions

type CsvOptions struct {
	Separator  rune
	LazyQuotes bool
}

type JsonInterface

type JsonInterface interface {
	// Marshal go structs into bytes
	Marshal(orig interface{}) ([]byte, error)
	// Marshal go structs into bytes and validates returned bytes
	MarshalWithSchemaValidation(sch string, orig interface{}) ([]byte, error)
	// Unmarshal bytes into go structs
	Unmarshal(blob []byte, dest interface{}) error
	// Validates input bytes and Unmarshal
	UnmarshalWithSchemaValidation(sch string, blob []byte, dest interface{}) error
}

type JsonOptions

type JsonOptions struct {
	Config                        jsonConfig
	IndentionStep                 int
	MarshalFloatWith6Digits       bool
	EscapeHTML                    bool
	SortMapKeys                   bool
	UseNumber                     bool
	DisallowUnknownFields         bool
	TagKey                        string
	OnlyTaggedField               bool
	ValidateJSONRawMessage        bool
	ObjectFieldMustBeSimpleString bool
	CaseSensitive                 bool
	// Schema contains schema definitions with key as schema name and value as source path
	// schema sources can be file or URL. Schema definition will be iniatialized during
	// JSON parser object initialization.
	Schema map[string]string
}

type Options

type Options struct {
	JsonOptions JsonOptions
	CsvOptions  CsvOptions
}

type Parser

type Parser interface {
	JsonParser() JsonInterface
	CsvParser() CsvInterface
}

func InitParser

func InitParser(log logger.Interface, opt Options) Parser

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL