Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTMLRender ¶
type HTMLRender struct {
// contains filtered or unexported fields
}
HTMLRender accepts templates and a layout that will parse all necessary html files.
func NewHTMLRenderer ¶
func NewHTMLRenderer(cfg ...HTMLRenderConfig) *HTMLRender
The constructor for the HTMLRender.
func (*HTMLRender) AddHook ¶
func (r *HTMLRender) AddHook(hook RendererHook)
Allows adding a hook to modify data globally.
func (*HTMLRender) Render ¶
func (r *HTMLRender) Render(w http.ResponseWriter, req *http.Request, name string, data map[string]any) hypergon.HypergonError
Render renders a html page with layout. The name must unique so it wont be a conflict to other html pages.
func (*HTMLRender) RenderPartial ¶
func (r *HTMLRender) RenderPartial(w http.ResponseWriter, name string, data any) error
RenderPartial renders a partial template without the layout The name must unique so it wont be a conflict to other partial htmls.
type HTMLRenderConfig ¶
type JSONRenderer ¶
type JSONRenderer struct{}
JSONRenderer object.
func (*JSONRenderer) JSON ¶
func (r *JSONRenderer) JSON(w http.ResponseWriter, data any) hypergon.HypergonError
JSON functions returns a json response.
type RendererHook ¶
Click to show internal directories.
Click to hide internal directories.