Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteMsgPack ¶
func WriteMsgPack(w http.ResponseWriter, obj any) error
WriteMsgPack writes MsgPack ContentType and encodes the given interface object.
Types ¶
type Data ¶
Data contains ContentType and bytes data.
func (Data) Write ¶
func (r Data) Write(w http.ResponseWriter) (err error)
Render (Data) writes data with custom ContentType.
func (Data) WriteContentType ¶
func (r Data) WriteContentType(w http.ResponseWriter)
WriteContentType (Data) writes custom ContentType.
type Delims ¶
type Delims struct { // Left delimiter, defaults to {{. Left string // Right delimiter, defaults to }}. Right string }
Delims represents a set of Left and Right delimiters for HTML template rendering.
type HTML ¶
HTML contains template reference and its name with given interface object.
func (HTML) Write ¶
func (r HTML) Write(w http.ResponseWriter) error
Render (HTML) executes template and writes its result with custom ContentType for response.
func (HTML) WriteContentType ¶
func (r HTML) WriteContentType(w http.ResponseWriter)
WriteContentType (HTML) writes HTML ContentType.
type HTMLProduction ¶
HTMLProduction contains template reference and its delims.
type HTMLRender ¶
type HTMLRender interface { // Instance returns an HTML instance. Instance(string, any) render.Render }
HTMLRender interface is to be implemented by HTMLProduction and HTMLDebug.
type MsgPack ¶
type MsgPack struct {
Data any
}
MsgPack contains the given interface object.
func (MsgPack) Write ¶
func (r MsgPack) Write(w http.ResponseWriter) error
Render (MsgPack) encodes the given interface object and writes data with custom ContentType.
func (MsgPack) WriteContentType ¶
func (r MsgPack) WriteContentType(w http.ResponseWriter)
WriteContentType (MsgPack) writes MsgPack ContentType.
type ProtoBuf ¶
type ProtoBuf struct {
Data any
}
ProtoBuf contains the given interface object.
func (ProtoBuf) Write ¶
func (r ProtoBuf) Write(w http.ResponseWriter) error
Render (ProtoBuf) marshals the given interface object and writes data with custom ContentType.
func (ProtoBuf) WriteContentType ¶
func (r ProtoBuf) WriteContentType(w http.ResponseWriter)
WriteContentType (ProtoBuf) writes ProtoBuf ContentType.
type Reader ¶
type Reader struct { ContentType string ContentLength int64 Reader io.Reader Headers map[string]string }
Reader contains the IO reader and its length, and custom ContentType and other headers.
func (Reader) Write ¶
func (r Reader) Write(w http.ResponseWriter) (err error)
Render (Reader) writes data with custom ContentType and headers.
func (Reader) WriteContentType ¶
func (r Reader) WriteContentType(w http.ResponseWriter)
WriteContentType (Reader) writes custom ContentType.
type Redirect ¶
Redirect contains the http request reference and redirects status code and location.
func (Redirect) Write ¶
func (r Redirect) Write(w http.ResponseWriter) error
Render (Redirect) redirects the http request to new location and writes redirect response.
func (Redirect) WriteContentType ¶
func (r Redirect) WriteContentType(http.ResponseWriter)
WriteContentType (Redirect) don't write any ContentType.
type XML ¶
type XML struct {
Data any
}
XML contains the given interface object.
func (XML) Write ¶
func (r XML) Write(w http.ResponseWriter) error
Render (XML) encodes the given interface object and writes data with custom ContentType.
func (XML) WriteContentType ¶
func (r XML) WriteContentType(w http.ResponseWriter)
WriteContentType (XML) writes XML ContentType for response.
type YAML ¶
type YAML struct {
Data any
}
YAML contains the given interface object.
func (YAML) Write ¶
func (r YAML) Write(w http.ResponseWriter) error
Render (YAML) marshals the given interface object and writes data with custom ContentType.
func (YAML) WriteContentType ¶
func (r YAML) WriteContentType(w http.ResponseWriter)
WriteContentType (YAML) writes YAML ContentType for response.