content

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 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

View Source
const (
	JSONFormat            = "json"
	XMLFormat             = "xml"
	XLSFormat             = "xls"
	CSVFormat             = "csv"
	JSONDataFormatTabular = "tabular"
)
View Source
const (
	XLSContentType    = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
	CSVContentType    = "text/csv"
	JSONContentType   = "application/json"
	TabularJSONFormat = "application/json"
	XMLContentType    = "application/xml"
)
View Source
const (
	HeaderContentType = "Content-Type"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CSV

type CSV struct {
	Codec
}

type CSVConfig

type CSVConfig struct {
	Separator string
	NullValue string

	InputMarshaller  *csv.Marshaller
	OutputMarshaller *csv.Marshaller
	// contains filtered or unexported fields
}

func (*CSVConfig) Unmarshal

func (c *CSVConfig) Unmarshal(bytes []byte, i interface{}) error

type Codec added in v0.14.0

type Codec struct {
	TypeName string
	// contains filtered or unexported fields
}

func (*Codec) CanMarshal added in v0.14.0

func (u *Codec) CanMarshal() bool

func (*Codec) CanUnmarshal added in v0.14.0

func (u *Codec) CanUnmarshal() bool

func (*Codec) Init added in v0.14.0

func (u *Codec) Init(lookupType xreflect.LookupType) error

func (*Codec) Marshal added in v0.14.0

func (u *Codec) Marshal(src interface{}) ([]byte, error)

func (*Codec) Unmarshal added in v0.14.0

func (u *Codec) Unmarshal(bytes []byte, dest interface{}) error

type Content

type Content struct {
	Marshaller  Marshallers        `json:",omitempty"`
	DateFormat  string             `json:",omitempty"`
	CSV         *CSVConfig         `json:",omitempty"`
	XLS         *XLSConfig         `json:",omitempty"`
	XML         *XMLConfig         `json:",omitempty"`
	TabularJSON *TabularJSONConfig `json:",omitempty"`
	Transforms  marshal.Transforms `json:"Transforms,omitempty" yaml:"Transforms,omitempty" `
	// contains filtered or unexported fields
}

func (*Content) InitMarshaller

func (c *Content) InitMarshaller(config *config.IOConfig, exclude []string, inputType, outputType reflect.Type) error

func (*Content) Marshal

func (c *Content) Marshal(format string, field string, response interface{}, options ...interface{}) ([]byte, error)

Marshal marshals response TODO refactor it to take just a marshaller for format, marshaller should only deal with response (requiring field, reader data seems code design issue)

func (*Content) UnmarshallerInterceptors

func (c *Content) UnmarshallerInterceptors() marshal.Transforms

type JSON

type JSON struct {
	Codec
	JsonMarshaller *json.Marshaller
}

type Marshaller

type Marshaller interface {
	Marshal(src interface{}) ([]byte, error)
}

type Marshallers added in v0.14.0

type Marshallers struct {
	XLS  XLS
	JSON JSON
	XML  Codec
	CSV  Codec
}

func (*Marshallers) Init added in v0.14.0

func (m *Marshallers) Init(lookupType xreflect.LookupType) error

type TabularJSONConfig

type TabularJSONConfig struct {
	FloatPrecision string

	InputMarhsaller  *tabjson.Marshaller
	OutputMarshaller *tabjson.Marshaller
	// contains filtered or unexported fields
}

type Unmarshaller

type Unmarshaller interface {
	Unmarshal(bytes []byte, dest interface{}) error
}

type XLS

type XLS struct {
	Codec
	XlsMarshaller *xlsy.Marshaller
}

type XLSConfig

type XLSConfig struct {
	DefaultStyle string
	SheetName    string
	Styles       map[string]string //name of style, values
}

func (*XLSConfig) Options

func (x *XLSConfig) Options() []xlsy.Option

type XMLConfig

type XMLConfig struct {
	FloatPrecision string

	InputMarshaller  *xmlify.Marshaller
	OutputMarshaller *xmlify.Marshaller
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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