httplibs

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultViewHandlerConfig = ViewHandlerConfig{
	ParamName: "name",
}

DefaultViewHandlerConfig 默认配置

Functions

This section is empty.

Types

type ViewHandler

type ViewHandler struct {
	ViewHandlerConfig

	v1log.InvokeLog
	// contains filtered or unexported fields
}

ViewHandler viewHandler

func NewViewHandler

func NewViewHandler(cnf ViewHandlerConfig) *ViewHandler

func (*ViewHandler) GinRouter

func (h *ViewHandler) GinRouter(r *gin.Engine, prefix string)

GinRouter 推荐的ginRouter配置

func (*ViewHandler) GinRouterJump

func (h *ViewHandler) GinRouterJump(r *gin.Engine, prefix string)

func (*ViewHandler) InitiateRender

func (h *ViewHandler) InitiateRender()

InitiateRender 初始化渲染器

func (*ViewHandler) LayoutFilePrefix

func (h *ViewHandler) LayoutFilePrefix() string

LayoutFilePrefix 布局文件前缀

func (*ViewHandler) Render

func (h *ViewHandler) Render() render.HTMLRender

func (*ViewHandler) ServeHTTP

func (h *ViewHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ViewHandler) ViewForGin

func (h *ViewHandler) ViewForGin(ctx *gin.Context)

type ViewHandlerConfig

type ViewHandlerConfig struct {
	ViewFs  embed.FS //模板渲染的viewFs
	ViewDir string   //模板渲染所在目录

	FuncMaps []template.FuncMap //模板文件迁入的函数map

	ParamName string                       //获取view渲染模板名称的参数名(如name)
	ParamFunc func(r *http.Request) string //定制化获取view渲染模板名称的方法(不存在则默认方式获取)

	OptionLayoutFlag string //布局文件前缀标志
}

ViewHandlerConfig viewHandler配置

Jump to

Keyboard shortcuts

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