view

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package view provides most common-use ghost.View implementations for developers.

Index

Constants

This section is empty.

Variables

View Source
var (
	NoContent   ghost.View = statusView(http.StatusNoContent)
	NotModified ghost.View = statusView(http.StatusNotModified)
)

Functions

func AsJson added in v0.0.2

func AsJson(v interface{}) (view ghost.View, err error)

func FromFile added in v0.0.2

func FromFile(f *os.File) (v ghost.View, err error)

Types

type Binary added in v0.0.2

type Binary []byte

func (Binary) Body added in v0.0.2

func (v Binary) Body() io.Reader

func (Binary) ContentType added in v0.0.2

func (v Binary) ContentType() string

func (Binary) Status added in v0.0.2

func (v Binary) Status() int

type GenericView

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

func Generic

func Generic(status int, body io.Reader) *GenericView

Generic returns a GenericView, which has a lot of methods to setup the response headers.

func (*GenericView) AddHeader

func (gv *GenericView) AddHeader(name, value string) *GenericView

func (*GenericView) BeforeSendHeader added in v0.0.2

func (gv *GenericView) BeforeSendHeader(h http.Header)

func (*GenericView) Body

func (gv *GenericView) Body() io.Reader

func (*GenericView) BodySize added in v0.0.2

func (gv *GenericView) BodySize(size int64) *GenericView

func (*GenericView) CacheDisable added in v0.0.2

func (gv *GenericView) CacheDisable() *GenericView

func (*GenericView) CachePrivate added in v0.0.2

func (gv *GenericView) CachePrivate(age time.Duration) *GenericView

func (*GenericView) CachePublic added in v0.0.2

func (gv *GenericView) CachePublic(age time.Duration) *GenericView

func (*GenericView) Download added in v0.0.2

func (gv *GenericView) Download(mode string, filename string) *GenericView

func (*GenericView) MediaType added in v0.0.2

func (gv *GenericView) MediaType(t string) *GenericView

func (*GenericView) Status

func (gv *GenericView) Status() int

type Html added in v0.0.3

type Html string

func (Html) Body added in v0.0.3

func (v Html) Body() io.Reader

func (Html) ContentType added in v0.0.3

func (v Html) ContentType() string

func (Html) Status added in v0.0.3

func (v Html) Status() int

type Json

type Json []byte

func (Json) Body added in v0.0.2

func (v Json) Body() io.Reader

func (Json) ContentType added in v0.0.2

func (v Json) ContentType() string

func (Json) Status added in v0.0.2

func (v Json) Status() int

type Text

type Text string

func (Text) Body

func (v Text) Body() io.Reader

func (Text) ContentType added in v0.0.2

func (v Text) ContentType() string

func (Text) Status

func (v Text) Status() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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