content

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxBufferSize = 32 << 20 // 32 MB
	MaxFilesize   = 32 << 20 // 32 MB
)

Variables

View Source
var (
	TWithFilename = reflect.TypeFor[WithFilename]()
	TWithHeader   = reflect.TypeFor[WithHeader]()
)

Functions

func AsReadCloser

func AsReadCloser(ctx context.Context, factory func(w io.WriteCloser) func() error) io.ReadCloser

func Pipe

func Pipe(r func(r io.Reader) error, w func(w io.Writer) error) error

Types

type Builder

type Builder interface {
	Content

	SetContentType(string)
	SetContentLength(int64)
	SetReadCloser(io.ReadCloser)
}

func NewBuilder

func NewBuilder(media string) Builder

func NewBuilderFrom

func NewBuilderFrom(media string, param map[string]string) Builder

type Content

type Content interface {
	ContentType() string
	ContentLength() int64

	io.ReadCloser
}

Content payload content

func New

func New(typ string) Content

func NewFrom

func NewFrom(media string, param map[string]string) Content

type FilenameModifier

type FilenameModifier interface {
	SetFilename(string)
}

FilenameModifier for setting multipart content filename

type HeaderApplier

type HeaderApplier interface {
	ApplyHeader(header http.Header)
}

type LengthDescriber

type LengthDescriber interface {
	ContentLength() int64
}

type LengthModifier

type LengthModifier interface {
	SetContentLength(int64)
}

type MediaTypeDescriber

type MediaTypeDescriber interface {
	ContentType() string
}

type MediaTypeModifier

type MediaTypeModifier interface {
	SetContentType(string)
}

type Modifier

type Modifier interface {
	SetContentType(string)
}

type Provider

type Provider interface {
	Prepare(ctx context.Context, src any) (Content, error)
}

type Reader

type Reader interface {
	Into(ctx context.Context, rc io.ReadCloser, dst any) error
}

Reader defined the behavior of reading data from an io.ReadCloser and deserializing into `dst`.

type ReaderFrom

type ReaderFrom interface {
	ReadFrom(rc io.ReadCloser) (int64, error)
}

type WithFilename

type WithFilename interface {
	Filename() string
}

WithFilename for getting multipart content filename

type WithHeader

type WithHeader interface {
	Header() http.Header
}

type Writer

type Writer interface {
	From(context.Context, io.WriteCloser, any) error
}

Jump to

Keyboard shortcuts

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