Documentation ¶
Overview ¶
+gengo:runtimedoc=false
Index ¶
- func ContextWithMgr(ctx context.Context, mgr Mgr) context.Context
- func ContextWithStatusCode(ctx context.Context, statusCode int) context.Context
- func EachParameter(ctx context.Context, tpe typesx.Type, each func(p *Parameter) bool)
- func EachRequestParameter(ctx context.Context, tpe typesx.Type, each func(rp *RequestParameter)) error
- func GroupedParametersSetFromContext(ctx context.Context) *sync.Map
- func MIMEHeader(headers ...textproto.MIMEHeader) textproto.MIMEHeader
- func NewValidator(ctx context.Context, fieldType typex.Type, tags map[string]Tag, omitempty bool, ...) (validator.Validator, error)
- func ParseTags(tag string) map[string]Tag
- func Register(transformers ...Transformer)
- func StatusCodeFromContext(ctx context.Context) int
- func StringifyPath(path string, params map[string]string) string
- func WithGroupedParametersSet(ctx context.Context, m *sync.Map) context.Context
- func Wrap(t Transformer, opt *CommonOption) interface{ ... }
- func WriteHeader(ctx context.Context, w io.Writer, contentType string, param map[string]string)
- type CanInterface
- type CanNextReader
- type CanNextWriter
- type CanString
- type CommonOption
- type FlattenParams
- type GroupedParameters
- type HeaderWriter
- type MayValidator
- type Mgr
- type Option
- type Parameter
- type ParameterValue
- type RequestParameter
- type StringBuilders
- type StringReader
- type StringReaders
- type Tag
- type Transformer
- type TransformerAndOption
- type TransformerDecoder
- type TransformerEncoder
- type WithHeader
- type WithNamedByTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithStatusCode ¶
func EachParameter ¶
func EachRequestParameter ¶
func MIMEHeader ¶
func MIMEHeader(headers ...textproto.MIMEHeader) textproto.MIMEHeader
func NewValidator ¶
func Register ¶
func Register(transformers ...Transformer)
func StatusCodeFromContext ¶
func Wrap ¶
func Wrap(t Transformer, opt *CommonOption) interface { TransformerEncoder TransformerDecoder }
Types ¶
type CanInterface ¶
type CanInterface interface {
Interface() any
}
type CanNextReader ¶
type CanNextReader interface {
NextReader() io.ReadCloser
}
type CanNextWriter ¶
type CommonOption ¶
type FlattenParams ¶
type FlattenParams struct {
Parameters []RequestParameter
}
func (*FlattenParams) CollectParams ¶
func (FlattenParams) NewValidator ¶
func (FlattenParams) String ¶
func (FlattenParams) String() string
func (*FlattenParams) Validate ¶
func (params *FlattenParams) Validate(v any) error
type GroupedParameters ¶
func CollectGroupedParameters ¶
func CollectGroupedParameters(ctx context.Context, tpe typesx.Type) GroupedParameters
type HeaderWriter ¶
type HeaderWriter interface { WithHeader io.Writer }
func WriterWithHeader ¶
func WriterWithHeader(w io.Writer, header http.Header) HeaderWriter
type MayValidator ¶
type Mgr ¶
type Mgr interface { NewTransformer(context.Context, typesx.Type, Option) (Transformer, error) GetTransformerNames(name string) []string }
func MgrFromContext ¶
type Parameter ¶
type ParameterValue ¶
type RequestParameter ¶
type RequestParameter struct { Parameter TransformerOption Option Transformer Transformer Validator validator.Validator }
type StringBuilders ¶
type StringBuilders struct {
// contains filtered or unexported fields
}
func NewStringBuilders ¶
func NewStringBuilders() *StringBuilders
func (*StringBuilders) NextWriter ¶
func (v *StringBuilders) NextWriter() io.Writer
func (*StringBuilders) SetN ¶
func (v *StringBuilders) SetN(n int)
func (*StringBuilders) StringSlice ¶
func (v *StringBuilders) StringSlice() []string
type StringReader ¶
type StringReader struct {
// contains filtered or unexported fields
}
func NewStringReader ¶
func NewStringReader(v string) *StringReader
func (*StringReader) Close ¶
func (r *StringReader) Close() error
func (*StringReader) Interface ¶
func (r *StringReader) Interface() any
func (*StringReader) String ¶
func (r *StringReader) String() string
type StringReaders ¶
type StringReaders struct { Readers []io.ReadCloser // contains filtered or unexported fields }
func NewStringReaders ¶
func NewStringReaders(values []string) *StringReaders
func (*StringReaders) Close ¶
func (v *StringReaders) Close() error
func (*StringReaders) Interface ¶
func (v *StringReaders) Interface() any
func (*StringReaders) Len ¶
func (v *StringReaders) Len() int
func (*StringReaders) NextReader ¶
func (v *StringReaders) NextReader() io.ReadCloser
type Transformer ¶
type Transformer interface { // Names should include name or alias of transformer // prefer using some keyword about content-type // first must validate content-type Names() []string // New will create transformer new transformer instance by type // in this step will to check transformer is valid for type New(context.Context, typesx.Type) (Transformer, error) TransformerEncoder TransformerDecoder }
func NewTransformer ¶
type TransformerAndOption ¶
type TransformerAndOption struct { Transformer Option Option }
type TransformerDecoder ¶
type TransformerDecoder interface { // DecodeFrom // will unmarshal data from read into some struct DecodeFrom(ctx context.Context, r io.ReadCloser, v any, headers ...textproto.MIMEHeader) error }
type TransformerEncoder ¶
type WithHeader ¶
type WithNamedByTag ¶
type WithNamedByTag interface {
NamedByTag() string
}
Click to show internal directories.
Click to hide internal directories.