ginview

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ginview Created by Teocci. Author: teocci@yandex.com on 2022-12월-24

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTML

func HTML(ctx *gin.Context, code int, name string, data interface{})

HTML is a render for template You should use helper func `Middleware()` to set the supplied TemplateEngine and make `HTML()` work validly.

func Middleware

func Middleware(e *ViewEngine) gin.HandlerFunc

Middleware gin middleware wrapper

func NewMiddleware

func NewMiddleware(config view.Config) gin.HandlerFunc

NewMiddleware gin middleware for func `gintemplate.HTML()`

Types

type ViewEngine

type ViewEngine struct {
	*view.Engine
}

ViewEngine view engine for gin

func Default

func Default(path string) *ViewEngine

Default new default engine

func New

func New(config view.Config) *ViewEngine

New creates a view engine for gin

func Wrap

func Wrap(engine *view.Engine) *ViewEngine

Wrap wraps a view engine for view.ViewEngine

func (*ViewEngine) HTML

func (e *ViewEngine) HTML(ctx *gin.Context, code int, name string, data interface{})

HTML render html

func (*ViewEngine) Instance

func (e *ViewEngine) Instance(name string, data interface{}) render.Render

Instance implement gin interface

type ViewRender

type ViewRender struct {
	Engine *ViewEngine
	Name   string
	Data   interface{}
}

ViewRender view render implement gin interface

func (ViewRender) Render

func (v ViewRender) Render(w http.ResponseWriter) error

Render (YAML) marshals the given interface object and writes data with custom ContentType.

func (ViewRender) WriteContentType

func (v ViewRender) WriteContentType(w http.ResponseWriter)

WriteContentType write html content type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL