templateh

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package templateh provides simple functions for using inside templates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a, b int) int

Add just returns a+b

func Dict

func Dict(values ...interface{}) (map[string]interface{}, error)

Dict groups passed values by pair in map[string]interface{}. It requires that length of values is even. Each odd value used as key and should be string. Following after it element (each even) is value for this key and may of any type. Dict("one", v1, "two", v2) => {"one": v1, "two": v2}

func NewEmptySlice

func NewEmptySlice(n int) []struct{}

NewEmptySlice returns new empty slice of integers with length and capacity = n. n should be not less than 0.

func NewRange

func NewRange(from, to, step int) (r []int)

NewRange returns slice of integers initialized with specified arithmetic progression. Progression defined by from and step: r[0]=from; r[i+1]=r[i]+step. to defines length (and capacity) of slice: (to-from)/step. If length (as described above) is negative or step is zero then panic will be raised. for (i=from; i<to; i+=step) for positive arguments.

func Sub

func Sub(a, b int) int

Sub just returns a-b

Types

This section is empty.

Jump to

Keyboard shortcuts

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