Documentation ¶
Index ¶
- func Data(w http.ResponseWriter, data []byte, contentType string) error
- func HTML(w http.ResponseWriter, data any, template *template.Template, name ...string) error
- func JSON(w http.ResponseWriter, data any, opts ...JSONOption) (err error)
- func MsgPack(w http.ResponseWriter, data any) error
- func ProtoBuf(w http.ResponseWriter, data any) error
- func Reader(w http.ResponseWriter, reader io.Reader, contentLength int64, ...) error
- func Redirect(w http.ResponseWriter, r *http.Request, location string, code int) error
- func TOML(w http.ResponseWriter, data any) error
- func Text(w http.ResponseWriter, format string, Data ...any) error
- func XML(w http.ResponseWriter, data any) error
- func YAML(w http.ResponseWriter, Data any) error
- type JSONOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Data ¶
func Data(w http.ResponseWriter, data []byte, contentType string) error
Data writes data with custom ContentType.
func JSON ¶
func JSON(w http.ResponseWriter, data any, opts ...JSONOption) (err error)
JSON marshals the given interface object and writes it with custom ContentType.
func MsgPack ¶
func MsgPack(w http.ResponseWriter, data any) error
MsgPack encodes the given interface object and writes data with custom ContentType.
func ProtoBuf ¶
func ProtoBuf(w http.ResponseWriter, data any) error
ProtoBuf marshals the given interface object and writes data with custom ContentType.
func Reader ¶
func Reader( w http.ResponseWriter, reader io.Reader, contentLength int64, contentType string, headers map[string]string, ) error
Reader writes data with custom ContentType and headers.
func TOML ¶
func TOML(w http.ResponseWriter, data any) error
TOML marshals the given interface object and writes data with custom ContentType.
func Text ¶
func Text(w http.ResponseWriter, format string, Data ...any) error
Text writes data with custom ContentType.
Types ¶
type JSONOption ¶
type JSONOption func(o *jsonOptions)
func AsciiJSON ¶
func AsciiJSON() JSONOption
func IndentedJSON ¶
func IndentedJSON(prefix, indent string) JSONOption
func JsonpJSON ¶
func JsonpJSON(callback string) JSONOption
func PureJSON ¶
func PureJSON() JSONOption
func SecureJSON ¶
func SecureJSON(prefix string) JSONOption
Click to show internal directories.
Click to hide internal directories.