core

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array[T any] = types.Array[T]

type Body

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

func NewBodyFromJS

func NewBodyFromJS(v js.Value) *Body

func (*Body) Binary

func (body *Body) Binary() ([]byte, string, error)

Binary -> data + mime (from binarySync/binaryTypeSync)

func (*Body) Files

func (body *Body) Files() ([]UploadFile, error)

Files -> read filesSync() array [{field,name,type,size,bytes:Uint8Array}]

func (*Body) Form

func (body *Body) Form(schema ...*pema.SchemaBuilder) (Dict, error)

returns parsed form, optionally validated with schema

func (*Body) JSON

func (body *Body) JSON(schema ...*pema.SchemaBuilder) (Dict, error)

JSON returns parsed JSON data, optionally validated with schema

func (*Body) Kind

func (body *Body) Kind() Kind

func (*Body) Text

func (body *Body) Text() (string, error)

Text -> string (from textSync)

type Dict

type Dict = types.Dict

type Kind

type Kind int
const (
	KindNone Kind = iota
	KindText
	KindJSON
	KindForm
	KindBin
)

type Object

type Object[T any] = types.Object[T]

type Request

type Request struct {
	Url     URL
	Body    *Body
	Path    *RequestBag
	Query   *RequestBag
	Headers *RequestBag
	Cookies *RequestBag
}

type RequestBag

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

func NewRequestBag

func NewRequestBag(data Dict, name string) *RequestBag

func (*RequestBag) Get

func (rb *RequestBag) Get(key string) (string, error)

func (*RequestBag) Has

func (rb *RequestBag) Has(key string) bool

func (*RequestBag) Parse

func (rb *RequestBag) Parse(schema *pema.SchemaBuilder, coerce ...bool) (Dict, error)

func (*RequestBag) Size

func (rb *RequestBag) Size() int

func (*RequestBag) ToJSON

func (rb *RequestBag) ToJSON() map[string]string

func (*RequestBag) Try

func (rb *RequestBag) Try(key string) string

type URL

type URL struct {
	Href         string
	Origin       string
	Protocol     string
	Username     string
	Password     string
	Host         string
	Hostname     string
	Port         string
	Pathname     string
	Search       string
	SearchParams Dict
	Hash         string
}

type UploadFile

type UploadFile struct {
	Field string
	Name  string
	Type  string
	Size  int64
	Bytes []byte
}

describes a file from multipart fields (bytes come from filesSync)

Jump to

Keyboard shortcuts

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