templates

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package templates [provides utility functions to enable templating in app configuration]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(tpl *template.Template, data interface{}) string

Execute template, returns empty string in case of errors

func Parse

func Parse(input string) (*template.Template, error)

Parse a template

func ParseAndExecute

func ParseAndExecute(input string, data interface{}) string

ParseAndExecute template, returns input string in case of errors. Expensive operation.

func ParseAndExecuteMapStruct

func ParseAndExecuteMapStruct(input map[string]interface{}, data interface{}) map[string]interface{}

ParseAndExecuteMapStruct is like ParseAndExecute but takes mapstructure as input

func SetProxiesURL

func SetProxiesURL(url string)

SetProxiesURL is used to override the default proxylist url

Types

type ContextKey

type ContextKey string

ContextKey used to work with context and not trigger linter

type MapStruct

type MapStruct struct {
	// contains filtered or unexported fields
}

MapStruct is a helper structure to parse configs in a format accepted by mapstructure package

func ParseMapStruct

func ParseMapStruct(input map[string]interface{}) (*MapStruct, error)

ParseMapStruct is like Parse but takes mapstructure as input

func (*MapStruct) Execute

func (tpl *MapStruct) Execute(data interface{}) map[string]interface{}

Execute same as regular Execute

Jump to

Keyboard shortcuts

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