http

package
v0.0.0-...-163abcc Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	FileHeader
}

func (*File) All

func (f *File) All(fileName string) []*multipart.FileHeader

func (*File) Empty

func (f *File) Empty(fileName string) bool

func (*File) Files

func (f *File) Files() map[string][]*multipart.FileHeader

func (*File) First

func (f *File) First(fileName string) *multipart.FileHeader

func (*File) Has

func (f *File) Has(fileName string) bool

func (*File) Index

func (f *File) Index(fileName string, index int) *multipart.FileHeader

func (*File) Name

func (f *File) Name(fileName string) Value

func (*File) String

func (f *File) String() string

type FileHeader

type FileHeader map[string][]*multipart.FileHeader

type InvalidError

type InvalidError[T any] struct {
	Key      string `json:"key"`
	Type     string `json:"type"`
	Value    T      `json:"value"`
	Contract string `json:"contract"`
	Op       string `json:"op"`
}

func (*InvalidError[T]) Builder

func (i *InvalidError[T]) Builder() *bytes.Buffer

func (*InvalidError[T]) Error

func (i *InvalidError[T]) Error() string

func (*InvalidError[T]) MarshalJSON

func (i *InvalidError[T]) MarshalJSON() ([]byte, error)

func (*InvalidError[T]) String

func (i *InvalidError[T]) String() string

type Json

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

func (*Json) Bytes

func (j *Json) Bytes() []byte

func (*Json) Decode

func (j *Json) Decode(v any) error

func (*Json) Get

func (j *Json) Get(path ...any) *Node

func (*Json) Reset

func (j *Json) Reset(data any) error

func (*Json) String

func (j *Json) String() string

func (*Json) Validate

func (j *Json) Validate(v any) error

type Node

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

func (*Node) Array

func (n *Node) Array() []any

func (*Node) Bool

func (n *Node) Bool() bool

func (*Node) Bytes

func (n *Node) Bytes() []byte

func (*Node) Exists

func (n *Node) Exists() bool

func (*Node) Float64

func (n *Node) Float64() float64

func (*Node) Get

func (n *Node) Get(path ...any) *Node

func (*Node) Int64

func (n *Node) Int64() int64

func (*Node) Len

func (n *Node) Len() int

func (*Node) Object

func (n *Node) Object() map[string]any

func (*Node) Raw

func (n *Node) Raw() string

func (*Node) String

func (n *Node) String() string

type Packer

type Packer interface {
}

type Parser

type Parser[T Packer] struct {
	// contains filtered or unexported fields
}

func (*Parser[T]) Auto

func (s *Parser[T]) Auto()

func (*Parser[T]) Error

func (s *Parser[T]) Error() error

func (*Parser[T]) Form

func (s *Parser[T]) Form()

func (*Parser[T]) Json

func (s *Parser[T]) Json()

func (*Parser[T]) Multipart

func (s *Parser[T]) Multipart()

func (*Parser[T]) Protobuf

func (s *Parser[T]) Protobuf()

func (*Parser[T]) Query

func (s *Parser[T]) Query()

func (*Parser[T]) SetMaxMemory

func (s *Parser[T]) SetMaxMemory(maxMemory int64)

func (*Parser[T]) Xml

func (s *Parser[T]) Xml()

type Protobuf

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

func (*Protobuf) Bytes

func (p *Protobuf) Bytes() []byte

func (*Protobuf) Decode

func (p *Protobuf) Decode(v proto.Message) error

func (*Protobuf) Reset

func (p *Protobuf) Reset(v proto.Message) error

func (*Protobuf) String

func (p *Protobuf) String() string

type Sender

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

func NewSender

func NewSender(w http.ResponseWriter, r *http.Request) *Sender

func (*Sender) Any

func (s *Sender) Any(data any) error

func (*Sender) Bytes

func (s *Sender) Bytes(data []byte) error

func (*Sender) File

func (s *Sender) File(fileName string, file io.Reader) error

func (*Sender) Json

func (s *Sender) Json(data any) error

func (*Sender) Protobuf

func (s *Sender) Protobuf(data proto.Message) error

func (*Sender) Redirect

func (s *Sender) Redirect(url string, code int)

func (*Sender) Respond

func (s *Sender) Respond(code int, msg any) error

func (*Sender) RespondWithError

func (s *Sender) RespondWithError(code int, err error) error

func (*Sender) String

func (s *Sender) String(data string) error

func (*Sender) Write

func (s *Sender) Write(r io.Reader) error

type Sse

type Sse[T any] struct {
	Stream      *Stream[T]
	LasTEventID int64
	// contains filtered or unexported fields
}

func (*Sse[T]) Any

func (s *Sse[T]) Any(data any) error

func (*Sse[T]) Bytes

func (s *Sse[T]) Bytes(data []byte) error

func (*Sse[T]) Done

func (s *Sse[T]) Done() <-chan struct{}

func (*Sse[T]) Flush

func (s *Sse[T]) Flush()

func (*Sse[T]) IsClose

func (s *Sse[T]) IsClose() bool

func (*Sse[T]) Json

func (s *Sse[T]) Json(data any) error

func (*Sse[T]) String

func (s *Sse[T]) String(data string) error

func (*Sse[T]) Wait

func (s *Sse[T]) Wait() error

type SseConfig

type SseConfig struct {
	Retry time.Duration
}

type Store

type Store struct {
	url.Values
}

func (*Store) Add

func (s *Store) Add(key string, value []string)

func (*Store) All

func (s *Store) All(key string) Values

func (*Store) Empty

func (s *Store) Empty(key string) bool

func (*Store) First

func (s *Store) First(key string) Value

func (*Store) Has

func (s *Store) Has(key string) bool

func (*Store) Index

func (s *Store) Index(key string, index int) Value

func (*Store) Remove

func (s *Store) Remove(key string)

func (*Store) String

func (s *Store) String() string

type Stream

type Stream[T Packer] struct {
	Time time.Time

	Response http.ResponseWriter
	Request  *http.Request

	Query    *Store
	Form     *Store
	File     *File
	Json     *Json
	Protobuf *Protobuf
	Xml      *Xml

	Params  socket.Params
	Context kitty.Context
	Logger  kitty.Logger

	Sender *Sender

	Parser *Parser[T]
	// contains filtered or unexported fields
}

func NewStream

func NewStream[T Packer](conn T, w http.ResponseWriter, r *http.Request) *Stream[T]

func (*Stream[T]) ClientIP

func (s *Stream[T]) ClientIP() string

func (*Stream) Conn

func (s *Stream) Conn() T

func (*Stream[T]) Forward

func (s *Stream[T]) Forward(fn func(stream *Stream[T]) error) error

func (*Stream[T]) Host

func (s *Stream[T]) Host() string

func (*Stream[T]) Scheme

func (s *Stream[T]) Scheme() string

func (*Stream[T]) SetHeader

func (s *Stream[T]) SetHeader(header string, content string)

func (*Stream[T]) String

func (s *Stream[T]) String() string

func (*Stream[T]) UpgradeSse

func (s *Stream[T]) UpgradeSse(config *SseConfig) (*Sse[T], error)

func (*Stream[T]) Url

func (s *Stream[T]) Url() string

type Type

type Type struct {
	Gte string
	Lte string
	Gt  string
	Lt  string
	Eq  string

	Required bool
	NonEmpty bool
	Default  string
}

type Validator

type Validator[T any] struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator[T any]() *Validator[T]

func (*Validator[T]) Bind

func (v *Validator[T]) Bind(t T) error

func (*Validator[T]) From

func (v *Validator[T]) From(bts []byte) *Validator[T]

func (*Validator[T]) Stream

func (v *Validator[T]) Stream(read io.Reader) *Validator[T]

type Value

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

func (Value) Bool

func (v Value) Bool() bool

func (Value) Bytes

func (v Value) Bytes() []byte

func (Value) Float64

func (v Value) Float64() float64

func (Value) Int

func (v Value) Int() int

func (Value) Int64

func (v Value) Int64() int64

func (Value) String

func (v Value) String() string

type Values

type Values []string

func (Values) Bool

func (v Values) Bool() []bool

func (Values) Bytes

func (v Values) Bytes() [][]byte

func (Values) Float64

func (v Values) Float64() []float64

func (Values) Int

func (v Values) Int() []int

func (Values) Int64

func (v Values) Int64() []int64

func (Values) String

func (v Values) String() []string

type Xml

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

func (*Xml) Bytes

func (j *Xml) Bytes() []byte

func (*Xml) Decode

func (j *Xml) Decode(v any) error

func (*Xml) Reset

func (j *Xml) Reset(data any) error

func (*Xml) String

func (j *Xml) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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