static

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(files map[string]*Content, redirects map[string]string, next http.Handler) http.Handler

Types

type Blob

type Blob []byte

func (Blob) Bytes

func (b Blob) Bytes() ([]byte, error)

func (Blob) Encoding

func (b Blob) Encoding() string

func (Blob) NewReader

func (b Blob) NewReader() (*gzip.Reader, error)

func (Blob) RawBytes

func (b Blob) RawBytes() []byte

func (Blob) String

func (b Blob) String() string

type Collection

type Collection struct {
	Files     map[string]*Content
	Hashified map[string]*Content
	Redirects map[string]string
}

func NewCollection

func NewCollection(entries ...Entry) *Collection

func (*Collection) Add added in v0.22.0

func (c *Collection) Add(b *Collection)

Add() adds elements from one collection, replacing those using the same key

func (*Collection) Extend added in v0.22.0

func (c *Collection) Extend(b *Collection)

Extend() adds elements from one collection that aren't present already

func (Collection) FuncMap

func (c Collection) FuncMap(hashify bool, prefix string) map[string]interface{}

func (*Collection) Handler

func (c *Collection) Handler(hashify bool, next http.Handler) http.Handler

func (*Collection) Middleware

func (c *Collection) Middleware(hashify bool) func(http.Handler) http.Handler

func (Collection) View added in v0.15.0

func (c Collection) View(hashify bool) (v *View)

type Content

type Content struct {
	Body         Blob
	ContentType  string
	CacheControl string
	MaxAge       int
	Sha1sum      string
}

func (Content) ServeHTTP

func (o Content) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Entry

type Entry struct {
	Name      string
	Hashified string
	Content   *Content
}

func NewEntry

func NewEntry(name, hashified string, content *Content) Entry

type PageInfo added in v0.19.0

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

func (PageInfo) Canonical added in v0.19.0

func (p PageInfo) Canonical() string

func (PageInfo) Handler added in v0.19.0

func (p PageInfo) Handler() http.Handler

func (PageInfo) Location added in v0.19.0

func (p PageInfo) Location() string

func (PageInfo) Methods added in v0.19.0

func (p PageInfo) Methods() []string

func (PageInfo) MimeType added in v0.19.0

func (p PageInfo) MimeType() []string

type PageRedirect added in v0.19.0

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

func (PageRedirect) Canonical added in v0.19.0

func (p PageRedirect) Canonical() string

func (PageRedirect) Error added in v0.19.0

func (p PageRedirect) Error() error

func (PageRedirect) Handler added in v0.19.0

func (p PageRedirect) Handler() http.Handler

func (PageRedirect) Location added in v0.19.0

func (p PageRedirect) Location() string

type View added in v0.15.0

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

func (View) Match added in v0.15.0

func (v View) Match(rctx *chi.Context, method, path string) bool

func (View) Middlewares added in v0.15.0

func (v View) Middlewares() (m chi.Middlewares)

func (View) PageInfo added in v0.19.0

func (v View) PageInfo(r *http.Request) (interface{}, bool)

web.RouterPageInfo

func (View) Routes added in v0.15.0

func (v View) Routes() []chi.Route

chi.Routes

func (View) ServeHTTP added in v0.15.0

func (v View) ServeHTTP(w http.ResponseWriter, r *http.Request)

http.Handler

func (View) TryServeHTTP added in v0.19.0

func (v View) TryServeHTTP(w http.ResponseWriter, r *http.Request) error

web.Handler

Jump to

Keyboard shortcuts

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