backward

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

*

  • This file lists the functions originally part of the Sprig library that are
  • intentionally excluded from the Sprout library. The exclusions are based on\
  • community decisions and technical evaluations aimed at enhancing security,
  • relevance, and performance in the context of Go templates.
  • Each exclusion is supported by rational and further community discussions
  • can be found on our GitHub issues page. *
  • Exclusion Criteria:
  • 1. Crypto functions: Deemed inappropriate for Go templates due to inherent security risks.
  • 2. Irrelevant functions: Omitted because they do not provide utility in the context of Go templates.
  • 3. Deprecated/Insecure: Functions using outdated or insecure standards are excluded.
  • 4. Temporary exclusions: Certain functions are temporarily excluded to prevent breaking changes,
  • pending the implementation of the new loader feature.
  • 5. Community decision: Choices made by the community are documented and can be discussed at
  • https://github.com/go-sprout/sprout/issues/1. *
  • The Sprout library is an open-source project and welcomes contributions from the community.
  • To discuss existing exclusions or propose new ones, please contribute to the discussions on
  • our GitHub repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackwardCompatibilityRegistry

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

func NewRegistry

func NewRegistry() *BackwardCompatibilityRegistry

NewRegistry creates a new instance of your registry with the embedded Handler.

func (*BackwardCompatibilityRegistry) Fail

func (bcr *BackwardCompatibilityRegistry) Fail(message string) (*uint, error)

! DEPRECATED: This should be removed in the next major version.

Fail creates an error with a specified message and returns a nil pointer alongside the created error. This function is typically used to indicate failure conditions in functions that return a pointer and an error.

Parameters:

message string - the error message to be associated with the returned error.

Returns:

*uint - always returns nil, indicating no value is associated with the failure.
error - the error object containing the provided message.

Example:

{{ "Operation failed" | fail }} // Output: nil, error with "Operation failed"

func (*BackwardCompatibilityRegistry) GetHostByName

func (bcr *BackwardCompatibilityRegistry) GetHostByName(name string) (string, error)

! DEPRECATED: This should be removed in the next major version. GetHostByName returns a random IP address associated with a given hostname.

Parameters:

name string - the hostname to resolve.

Returns:

string - a randomly selected IP address associated with the hostname.
error - an error object if the hostname cannot be resolved.

Note: This function currently lacks error handling

Example:

{{ getHostByName "example.com" }} // Output: "237.84.2.178"

func (*BackwardCompatibilityRegistry) LinkHandler

func (bcr *BackwardCompatibilityRegistry) LinkHandler(fh sprout.Handler) error

LinkHandler links the handler to the registry at runtime.

func (*BackwardCompatibilityRegistry) RegisterFunctions

func (bcr *BackwardCompatibilityRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error

RegisterFunctions registers all functions of the registry.

func (*BackwardCompatibilityRegistry) Uid

Uid returns the unique identifier of the registry.

func (*BackwardCompatibilityRegistry) UrlJoin

func (bcr *BackwardCompatibilityRegistry) UrlJoin(d map[string]any) (string, error)

! DEPRECATED: This should be removed in the next major version. UrlJoin constructs a URL string from a given map of URL components.

Parameters:

d map[string]any - a map containing the URL components: "scheme", "host",
										"path", "query", "opaque", "fragment", and "userinfo".

Returns:

string - the constructed URL string.
error - an error object if the URL components are invalid.

Example:

{{ dict scheme="https" host="example.com" path="/path" query="query=1" opaque="opaque" fragment="fragment" | urlJoin }} // Output: "https://example.com/path?query=1#fragment"

func (*BackwardCompatibilityRegistry) UrlParse

func (bcr *BackwardCompatibilityRegistry) UrlParse(v string) (map[string]any, error)

! DEPRECATED: This should be removed in the next major version. UrlParse parses a given URL string and returns a map with its components.

Parameters:

v string - the URL string to parse.

Returns:

map[string]any - a map containing the URL components: "scheme", "host",
								"hostname", "path", "query", "opaque", "fragment", and "userinfo".
error - an error object if the URL string is invalid.

Example:

{{ "https://example.com/path?query=1#fragment" | urlParse }} // Output: map[fragment:fragment host:example.com hostname:example.com path:path query:query scheme:https]

Jump to

Keyboard shortcuts

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