parser

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 12 Imported by: 0

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