Documentation
¶
Index ¶
- func IsAlnum(ch byte) bool
- func IsAlpha(ch byte) bool
- func IsBlank(ch byte) bool
- func IsCntrl(ch byte) bool
- func IsDigit(ch byte) bool
- func IsGraph(ch byte) bool
- func IsLower(ch byte) bool
- func IsPrint(ch byte) bool
- func IsPunct(ch byte) bool
- func IsSpace(ch byte) bool
- func IsUpper(ch byte) bool
- func IsXdigit(ch byte) bool
- func ToLower(ch byte) byte
- func ToUpper(ch byte) byte
- type Context
- func (self *Context) AddHeader(key string, val string)
- func (self *Context) HTML(code int, html string) error
- func (self *Context) Header(key string) string
- func (self *Context) JSON(code int, obj any) error
- func (self *Context) Param(key string) string
- func (self *Context) Query(key string) string
- func (self *Context) Redirect(url string)
- func (self *Context) Send(code int, body any) error
- func (self *Context) SetHeader(key string, val string)
- func (self *Context) Status(code int)
- type H
- type HandleFunc
- type Http
- func (self *Http) Delete(path string, handleFunc HandleFunc)
- func (self *Http) Get(path string, handleFunc HandleFunc)
- func (self *Http) Head(path string, handleFunc HandleFunc)
- func (self *Http) Options(path string, handleFunc HandleFunc)
- func (self *Http) Patch(path string, handleFunc HandleFunc)
- func (self *Http) Post(path string, handleFunc HandleFunc)
- func (self *Http) Put(path string, handleFunc HandleFunc)
- func (self *Http) Run(addr string) error
- type Tbl
- func (self Tbl[K, V]) Filter(fn func(key K, val V) bool) Tbl[K, V]
- func (self Tbl[K, V]) FilterMap(fn func(key K, val V) (bool, V)) Tbl[K, V]
- func (self Tbl[K, V]) IsAll(fn func(key K, val V) bool) bool
- func (self Tbl[K, V]) IsAny(fn func(key K, val V) bool) bool
- func (self Tbl[K, V]) IsEmpty() bool
- func (self Tbl[K, V]) Keys() Vec[K]
- func (self Tbl[K, V]) Len() int
- func (self Tbl[K, V]) Map(fn func(key K, val V) V) Tbl[K, V]
- func (self Tbl[K, V]) Pop(key K) V
- func (self Tbl[K, V]) Put(key K, val V)
- type Vec
- func (self *Vec[T]) Cap() int
- func (self *Vec[T]) Del(idx int) T
- func (self *Vec[T]) Filter(fn func(i int, it T) bool) Vec[T]
- func (self *Vec[T]) FilterMap(fn func(i int, it T) (bool, T)) Vec[T]
- func (self *Vec[T]) Index(fn func(it T) bool) int
- func (self *Vec[T]) Ins(idx int, it T)
- func (self *Vec[T]) IsAll(fn func(i int, it T) bool) bool
- func (self *Vec[T]) IsAny(fn func(i int, it T) bool) bool
- func (self *Vec[T]) IsEmpty() bool
- func (self *Vec[T]) IsExist(fn func(it T) bool) bool
- func (self *Vec[T]) IsSort(fn func(a, b T) int) bool
- func (self *Vec[T]) Len() int
- func (self *Vec[T]) Map(fn func(i int, it T) T) Vec[T]
- func (self *Vec[T]) Pop() T
- func (self *Vec[T]) Put(it T)
- func (self *Vec[T]) Sort(fn func(a, b T) int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct {
// origin objects
Response http.ResponseWriter
Request *http.Request
// Request info
Path string
Method string
// Response info
StatusCode int
}
func (*Context) AddHeader ¶
AddHeader adds the key, value pair to the header. It appends to any existing values associated with key.
func (*Context) Header ¶
Header gets the first value associated with the given key. If there are no values associated with the key. Get return "".
type HandleFunc ¶
type HandleFunc func(ctx *Context)
type Http ¶
type Http struct {
// contains filtered or unexported fields
}
func (*Http) Delete ¶
func (self *Http) Delete(path string, handleFunc HandleFunc)
func (*Http) Get ¶
func (self *Http) Get(path string, handleFunc HandleFunc)
func (*Http) Head ¶
func (self *Http) Head(path string, handleFunc HandleFunc)
func (*Http) Options ¶
func (self *Http) Options(path string, handleFunc HandleFunc)
func (*Http) Patch ¶
func (self *Http) Patch(path string, handleFunc HandleFunc)
func (*Http) Post ¶
func (self *Http) Post(path string, handleFunc HandleFunc)
func (*Http) Put ¶
func (self *Http) Put(path string, handleFunc HandleFunc)
type Tbl ¶
type Tbl[K comparable, V any] map[K]V
Tbl is a generic map-like structure for keys of any comparable type K and values of any type V.
func NewTbl ¶
func NewTbl[K comparable, V any](args ...any) Tbl[K, V]
NewTbl returns Tbl[K, V], There are two calling forms:
NewTbl[K, V]() returns a Tbl[K, V] of length 0. NewTbl[K, V](map[K, V] | Tbl[K, V]) returns a shallow copy of the given map or Tbl.
func (Tbl[K, V]) Filter ¶
Filter creates a new Tbl with only the key-value pairs that satisfy the provided function.
func (Tbl[K, V]) FilterMap ¶
FilterMap applies a function to each key-value pair, filtering and transforming the pairs in the process.
func (Tbl[K, V]) Map ¶
Map applies a function to each key-value pair and returns a new Tbl with the results.
type Vec ¶
type Vec[T any] []T
Vec is a generic vector type for elements of any type.
func NewVec ¶
NewVec returns a Vec[T]. There are three calling forms:
NewVec[T]() returns a Vec[T] of length 0 and capacity 8. NewVec[T](cap) returns a Vec[T] of length 0 and capacity parameter cap. NewVec[T](array[T] | slice[T] | Vec[T]) returns a shallow copy of the given array, slice, or Vec.
func (*Vec[T]) Filter ¶
Filter returns a new Vec containing only the elements that satisfy the provided function.
func (*Vec[T]) FilterMap ¶
FilterMap returns a new Vec with elements that satisfy the function and applies another transformation.
func (*Vec[T]) Index ¶
Index returns the first index where the provided function returns true, or -1 if no element matches.
func (*Vec[T]) IsAll ¶
IsAll returns true if all elements in the vector satisfy the provided function.
func (*Vec[T]) IsAny ¶
IsAny returns true if any element in the vector satisfies the provided function.
func (*Vec[T]) IsExist ¶
IsExist checks if any element in the vector satisfies the provided function.
func (*Vec[T]) IsSort ¶
IsSort checks if the vector is sorted according to the comparison function provided.
func (*Vec[T]) Map ¶
Map returns a new Vec constructed by applying the provided function to each element of the vector.