Documentation
¶
Index ¶
- Constants
- func Cast[T any](value any, defaults ...T) T
- func CastOK[T any](value any) (T, bool)
- func CloneStringMap(input map[string]any) map[string]any
- func ColorEnabled(writer io.Writer) bool
- func DefaultContext() context.Context
- func In(t time.Time) time.Time
- func Location() *time.Location
- func NormalizeContext(ctx context.Context) context.Context
- func Now() time.Time
- func Parse(layout string, value string) (time.Time, error)
- func SetClock(clock Clock)
- func SetLocation(location *time.Location)
- func TypeName(value reflect.Type) string
- func TypeOf[T any]() reflect.Type
- type Clock
- type Empty
- type FixedClock
- type JSONRaw
- type ListMeta
- type Map
- type Page
- type PageMeta
- type PageRequest
- type Scroll
- type ScrollMeta
- type ScrollRequest
- type Stream
- type UploadFile
- type ViewBody
Constants ¶
const ( MIMETextPlain = "text/plain; charset=utf-8" MIMETextHTML = "text/html; charset=utf-8" MIMEApplicationJSON = "application/json; charset=utf-8" MIMEApplicationXML = "application/xml; charset=utf-8" MIMEOctetStream = "application/octet-stream" MIMEFormURLEncoded = "application/x-www-form-urlencoded" MIMEMultipartForm = "multipart/form-data" )
Variables ¶
This section is empty.
Functions ¶
func CloneStringMap ¶
CloneStringMap deep-copies a map[string]any whose nested maps use map[string]any.
func ColorEnabled ¶ added in v0.1.1
ColorEnabled reports whether ANSI colors should be emitted for writer.
func DefaultContext ¶
DefaultContext returns Runa's fallback root context.
func NormalizeContext ¶
NormalizeContext returns DefaultContext when ctx is nil.
func SetClock ¶
func SetClock(clock Clock)
SetClock overrides the application clock. Passing nil restores the system clock.
func SetLocation ¶
SetLocation sets the application timezone.
Types ¶
type FixedClock ¶
FixedClock always returns the same time.
type JSONRaw ¶
type JSONRaw []byte
JSONRaw stores raw JSON bytes.
func (JSONRaw) MarshalJSON ¶
MarshalJSON returns raw JSON bytes.
func (*JSONRaw) UnmarshalJSON ¶
UnmarshalJSON keeps the original JSON subtree bytes.
type ListMeta ¶
type ListMeta interface {
ListMeta() Map
}
ListMeta is the common list metadata contract.
type PageMeta ¶
type PageMeta struct {
Page int `json:"page"`
PageSize int `json:"page_size"`
Total int `json:"total"`
}
PageMeta stores offset pagination output metadata.
type PageRequest ¶
PageRequest stores offset pagination input.
type ScrollMeta ¶
type ScrollMeta struct {
Cursor string `json:"cursor,omitempty"`
Limit int `json:"limit"`
Next string `json:"next,omitempty"`
}
ScrollMeta stores cursor pagination output metadata.
func (ScrollMeta) ListMeta ¶
func (meta ScrollMeta) ListMeta() Map
ListMeta returns scroll metadata as a map.
type ScrollRequest ¶
ScrollRequest stores cursor pagination input.
type UploadFile ¶
type UploadFile struct {
Filename string
Size int64
ContentType string
Header *multipart.FileHeader
}
UploadFile describes an uploaded multipart file.