Documentation
¶
Index ¶
- Constants
- Variables
- type CSV
- type CSVConfig
- type Codec
- type Content
- func (c *Content) InitMarshaller(config *config.IOConfig, exclude []string, inputType, outputType reflect.Type, ...) error
- func (c *Content) Marshal(format string, field string, response interface{}, options ...interface{}) ([]byte, error)
- func (c *Content) UnmarshallerInterceptors() marshal.Transforms
- type JSON
- func (j *JSON) CanMarshal() bool
- func (j *JSON) CanUnmarshal() bool
- func (j *JSON) Init(lookupType xreflect.LookupType) error
- func (j *JSON) Marshal(src interface{}) ([]byte, error)
- func (j *JSON) RuntimeMarshallerEngine() JSONMarshallerEngine
- func (j *JSON) RuntimeUnmarshallerEngine() JSONUnmarshallerEngine
- func (j *JSON) Unmarshal(bytes []byte, dest interface{}) error
- type JSONMarshallerEngine
- type JSONRuntimeInitializer
- type JSONUnmarshallerEngine
- type LegacyJSONRuntime
- type LegacyTabularJSONRuntime
- type Marshaller
- type Marshallers
- type StructologyJSONRuntime
- func (m *StructologyJSONRuntime) InitJSONRuntime(ioConfig *config.IOConfig, _ *legacyjson.Marshaller) error
- func (m *StructologyJSONRuntime) Marshal(src interface{}, options ...interface{}) ([]byte, error)
- func (m *StructologyJSONRuntime) Unmarshal(bytes []byte, dest interface{}, options ...interface{}) error
- type StructologyTabularJSONRuntime
- func (m *StructologyTabularJSONRuntime) InitTabularJSONRuntime(cfg *TabularJSONConfig, _ []string, _ reflect.Type, _ reflect.Type) error
- func (m *StructologyTabularJSONRuntime) Marshal(src interface{}, options ...interface{}) ([]byte, error)
- func (m *StructologyTabularJSONRuntime) Unmarshal(bytes []byte, dest interface{}) error
- type TabularJSONConfig
- type TabularJSONMarshallerEngine
- type TabularJSONRuntimeInitializer
- type TabularJSONUnmarshallerEngine
- type Unmarshaller
- type XLS
- type XLSConfig
- type XMLConfig
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 ¶
View Source
var DefaultJSONEngineTypeName = reflect.TypeOf(StructologyJSONRuntime{}).PkgPath() + "/" + reflect.TypeOf(StructologyJSONRuntime{}).Name()
View Source
var DefaultTabularJSONEngineTypeName = reflect.TypeOf(StructologyTabularJSONRuntime{}).PkgPath() + "/" + reflect.TypeOf(StructologyTabularJSONRuntime{}).Name()
Functions ¶
This section is empty.
Types ¶
type CSVConfig ¶
type CSVConfig struct {
Separator string
NullValue string
InputMarshaller *csv.Marshaller
OutputMarshaller *csv.Marshaller
// contains filtered or unexported fields
}
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 (*Codec) CanUnmarshal ¶ added in v0.14.0
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 (*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 {
Engine string `json:",omitempty" yaml:",omitempty"`
MarshalTypeName string `json:",omitempty" yaml:",omitempty"`
UnmarshalTypeName string `json:",omitempty" yaml:",omitempty"`
JsonMarshaller *json.Marshaller `json:"-" yaml:"-"`
RuntimeMarshaller JSONMarshallerEngine `json:"-" yaml:"-"`
RuntimeUnmarshaller JSONUnmarshallerEngine `json:"-" yaml:"-"`
// contains filtered or unexported fields
}
func (*JSON) CanMarshal ¶ added in v0.38.0
func (*JSON) CanUnmarshal ¶ added in v0.38.0
func (*JSON) RuntimeMarshallerEngine ¶ added in v0.38.0
func (j *JSON) RuntimeMarshallerEngine() JSONMarshallerEngine
func (*JSON) RuntimeUnmarshallerEngine ¶ added in v0.38.0
func (j *JSON) RuntimeUnmarshallerEngine() JSONUnmarshallerEngine
type JSONMarshallerEngine ¶ added in v0.38.0
type JSONRuntimeInitializer ¶ added in v0.38.0
type JSONRuntimeInitializer interface {
InitJSONRuntime(ioConfig *config.IOConfig, legacy *legacyjson.Marshaller) error
}
type JSONUnmarshallerEngine ¶ added in v0.38.0
type LegacyJSONRuntime ¶ added in v0.38.0
type LegacyJSONRuntime struct {
// contains filtered or unexported fields
}
func (*LegacyJSONRuntime) InitJSONRuntime ¶ added in v0.38.0
func (m *LegacyJSONRuntime) InitJSONRuntime(_ *config.IOConfig, legacy *legacyjson.Marshaller) error
func (*LegacyJSONRuntime) Marshal ¶ added in v0.38.0
func (m *LegacyJSONRuntime) Marshal(src interface{}, options ...interface{}) ([]byte, error)
func (*LegacyJSONRuntime) Unmarshal ¶ added in v0.38.0
func (m *LegacyJSONRuntime) Unmarshal(bytes []byte, dest interface{}, options ...interface{}) error
type LegacyTabularJSONRuntime ¶ added in v0.38.0
type LegacyTabularJSONRuntime struct {
// contains filtered or unexported fields
}
func (*LegacyTabularJSONRuntime) InitTabularJSONRuntime ¶ added in v0.38.0
func (m *LegacyTabularJSONRuntime) InitTabularJSONRuntime(cfg *TabularJSONConfig, excludedPaths []string, inputType, outputType reflect.Type) error
func (*LegacyTabularJSONRuntime) Marshal ¶ added in v0.38.0
func (m *LegacyTabularJSONRuntime) Marshal(src interface{}, options ...interface{}) ([]byte, error)
func (*LegacyTabularJSONRuntime) Unmarshal ¶ added in v0.38.0
func (m *LegacyTabularJSONRuntime) Unmarshal(bytes []byte, dest interface{}) error
type Marshaller ¶
type Marshallers ¶ added in v0.14.0
func (*Marshallers) Init ¶ added in v0.14.0
func (m *Marshallers) Init(lookupType xreflect.LookupType) error
type StructologyJSONRuntime ¶ added in v0.38.0
type StructologyJSONRuntime struct {
// contains filtered or unexported fields
}
func (*StructologyJSONRuntime) InitJSONRuntime ¶ added in v0.38.0
func (m *StructologyJSONRuntime) InitJSONRuntime(ioConfig *config.IOConfig, _ *legacyjson.Marshaller) error
func (*StructologyJSONRuntime) Marshal ¶ added in v0.38.0
func (m *StructologyJSONRuntime) Marshal(src interface{}, options ...interface{}) ([]byte, error)
func (*StructologyJSONRuntime) Unmarshal ¶ added in v0.38.0
func (m *StructologyJSONRuntime) Unmarshal(bytes []byte, dest interface{}, options ...interface{}) error
type StructologyTabularJSONRuntime ¶ added in v0.38.0
type StructologyTabularJSONRuntime struct {
// contains filtered or unexported fields
}
func (*StructologyTabularJSONRuntime) InitTabularJSONRuntime ¶ added in v0.38.0
func (m *StructologyTabularJSONRuntime) InitTabularJSONRuntime(cfg *TabularJSONConfig, _ []string, _ reflect.Type, _ reflect.Type) error
func (*StructologyTabularJSONRuntime) Marshal ¶ added in v0.38.0
func (m *StructologyTabularJSONRuntime) Marshal(src interface{}, options ...interface{}) ([]byte, error)
func (*StructologyTabularJSONRuntime) Unmarshal ¶ added in v0.38.0
func (m *StructologyTabularJSONRuntime) Unmarshal(bytes []byte, dest interface{}) error
type TabularJSONConfig ¶
type TabularJSONConfig struct {
FloatPrecision string
Engine string `json:",omitempty" yaml:",omitempty"`
InputMarhsaller TabularJSONUnmarshallerEngine `json:"-" yaml:"-"`
OutputMarshaller TabularJSONMarshallerEngine `json:"-" yaml:"-"`
// contains filtered or unexported fields
}
type TabularJSONMarshallerEngine ¶ added in v0.38.0
type TabularJSONRuntimeInitializer ¶ added in v0.38.0
type TabularJSONRuntimeInitializer interface {
InitTabularJSONRuntime(cfg *TabularJSONConfig, excludedPaths []string, inputType, outputType reflect.Type) error
}
type TabularJSONUnmarshallerEngine ¶ added in v0.38.0
type Unmarshaller ¶
type XLS ¶
type XLS struct {
Codec
XlsMarshaller *xlsy.Marshaller
}
type XLSConfig ¶
type XMLConfig ¶
type XMLConfig struct {
FloatPrecision string
InputMarshaller *xmlify.Marshaller
OutputMarshaller *xmlify.Marshaller
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.