tplfunc

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package tplfunc implements functions avalilable inside templates

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pager

func Pager(args url.Values, count interface{}, argPrefix string, rowsMax, around, edge int64) *[]Page

Pager returns array with pagination links

func SetProtoFuncs

func SetProtoFuncs(funcs template.FuncMap)

SetProtoFuncs appends function templates and not related to request functions to funcs This func is not for use in templates

func SetRequestFuncs

func SetRequestFuncs(funcs template.FuncMap, ctx *gin.Context)

SetRequestFuncs appends funcs which return real data inside request processing This func is not for use in templates

func SetSimpleFuncs

func SetSimpleFuncs(funcs template.FuncMap)

SetSimpleFuncs registers all prevoious funcs in given FuncMap This func is not for use in templates

Types

type Meta

type Meta struct {
	base.Meta
	JS  []string
	CSS []string
}

Meta holds template metadata This func is not for use in templates

func NewMeta

func NewMeta(status int, ctype string) *Meta

NewMeta returns new initialised Meta struct This func is not for use in templates

func (*Meta) AddCSS

func (p *Meta) AddCSS(file string) (string, error)

AddCSS - add .css file to styles list

func (*Meta) AddJS

func (p *Meta) AddJS(file string) (string, error)

AddJS - add .js file to scripts list

type Page

type Page struct {
	ID      int64 // Page number
	IsPrev  bool  // Is it a 'prev' link
	IsNext  bool  // Is it a 'last' link
	Allowed bool
	Href    string // Page href

}

Page holds pagination functionality

Jump to

Keyboard shortcuts

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