templates

package
v6.5.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFound = http.NotFound

NotFound is called when no asset is found. It defaults to http.NotFound but can be overwritten

Server is simply ServeHTTP but wrapped in http.HandlerFunc so it can be passed into net/http functions directly.

Functions

func Hash

func Hash(file string) (s string)

Hash returns the hex-encoded SHA256 hash of the original file Used for the Etag, and useful for caching Returns an empty string if the file is not in the bundle

func ModTime

func ModTime(file string) (t time.Time)

ModTime returns the modification time of the original file. Useful for caching purposes Returns zero time if the file is not in the bundle

func Open

func Open(name string) (io.ReadCloser, error)

Open allows you to read an embedded file directly. It will return a decompressing Reader if the file is embedded in compressed format. You should close the Reader after you're done with it.

func OpenGlob

func OpenGlob(name string) ([]io.ReadCloser, error)

Slower than Open as it must cycle through every element in map. Open all files that match glob.

func ServeHTTP

func ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP serves a request, attempting to reply with an embedded file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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