internal

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HEADER_CONTENT_DISPOSITION = "Content-Disposition"
	HEADER_CONTENT_TYPE        = "Content-Type"

	True = "true"

	JsonTagName      = "json"
	MultipartTagName = "multipart"
)

Variables

View Source
var (
	ContentProcessServiceInstance = new(ContentProcessService)
	ContentProcessRegistryService = newContentProcessRegistry(ContentProcessServiceInstance)
)

Functions

func BuildJsonValueBinder

func BuildJsonValueBinder(rv reflect.Value) structproto.ValueBinder

func Indirect

func Indirect(v interface{}) (reflect.Value, error)

Types

type BodyBinder added in v0.2.1

type BodyBinder struct {
	// contains filtered or unexported fields
}

func NewBodyBinder added in v0.2.1

func NewBodyBinder(content []byte) *BodyBinder

func (*BodyBinder) Bind added in v0.2.1

func (binder *BodyBinder) Bind(field structproto.FieldInfo, rv reflect.Value) error

Bind implements structproto.StructBinder.

func (*BodyBinder) Deinit added in v0.2.1

func (binder *BodyBinder) Deinit(context *structproto.StructProtoContext) error

Deinit implements structproto.StructBinder.

func (*BodyBinder) Init added in v0.2.1

func (binder *BodyBinder) Init(context *structproto.StructProtoContext) error

Init implements structproto.StructBinder.

type ContentProcessRegistry

type ContentProcessRegistry struct {
	// contains filtered or unexported fields
}

func (*ContentProcessRegistry) Get

func (registry *ContentProcessRegistry) Get(mediatype string) ContentProcessor

func (*ContentProcessRegistry) RegisterContentProcessor

func (registry *ContentProcessRegistry) RegisterContentProcessor(mediatype string, processor ContentProcessor) bool

func (*ContentProcessRegistry) Setup

func (registry *ContentProcessRegistry) Setup(
	queryArgsProcessor StringContentProcessor,
	processors map[string]ContentProcessor)

type ContentProcessService

type ContentProcessService struct {
	// contains filtered or unexported fields
}

func (*ContentProcessService) Process

func (service *ContentProcessService) Process(target interface{}, content []byte, contentType string) error

func (*ContentProcessService) ProcessQueryArgs

func (service *ContentProcessService) ProcessQueryArgs(target interface{}, content string) error

type ContentProcessor

type ContentProcessor func(content []byte, target interface{}) error

type ContentType

type ContentType struct {
	// contains filtered or unexported fields
}

func ParseContentType

func ParseContentType(contentType string) (ContentType, error)

func (ContentType) IsMultipartTypes

func (t ContentType) IsMultipartTypes() bool

RFC 7231 section 3.1.1.4 & RFC 2046 section 5.1.1

type HttpArg

type HttpArg struct {
	// contains filtered or unexported fields
}

func NewHttpArg

func NewHttpArg(target interface{}) *HttpArg

func (*HttpArg) Process

func (arg *HttpArg) Process(content []byte, processor ContentProcessor) error

func (*HttpArg) ProcessContent

func (arg *HttpArg) ProcessContent(content []byte, contentType string) error

func (*HttpArg) ProcessQueryString

func (arg *HttpArg) ProcessQueryString(query string) error

func (*HttpArg) Validate

func (arg *HttpArg) Validate() error

type JsonValueBinder

type JsonValueBinder reflect.Value

func (JsonValueBinder) Bind

func (binder JsonValueBinder) Bind(content interface{}) error

type MultipartContentBinder

type MultipartContentBinder struct {
	// contains filtered or unexported fields
}

func (*MultipartContentBinder) Bind

func (*MultipartContentBinder) Deinit

func (*MultipartContentBinder) Init

type MultipartProcessor

type MultipartProcessor struct {
	// contains filtered or unexported fields
}

func (*MultipartProcessor) Process

func (p *MultipartProcessor) Process(content []byte, target interface{}) error

type QueryArgsBinder

type QueryArgsBinder struct {
	// contains filtered or unexported fields
}

func NewQueryArgsBinder

func NewQueryArgsBinder(values url.Values) *QueryArgsBinder

func (*QueryArgsBinder) Bind

func (binder *QueryArgsBinder) Bind(field structproto.FieldInfo, rv reflect.Value) error

func (*QueryArgsBinder) Deinit

func (binder *QueryArgsBinder) Deinit(context *structproto.StructProtoContext) error

func (*QueryArgsBinder) Init

func (binder *QueryArgsBinder) Init(context *structproto.StructProtoContext) error

type StringContentProcessor

type StringContentProcessor func(content string, target interface{}) error

type Validatable

type Validatable interface {
	Validate() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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