Documentation ¶
Overview ¶
Package resource provides data transfer objects for NVGD's protocol and filters.
Index ¶
- Constants
- Variables
- type Options
- type ReadSeekCloser
- type Resource
- func (r *Resource) GuessContentType(s string) *Resource
- func (r *Resource) Put(name string, value interface{}) *Resource
- func (r *Resource) PutContentType(s string) *Resource
- func (r *Resource) PutFilename(s string) *Resource
- func (r *Resource) PutString(name, value string) *Resource
- func (r *Resource) Raw() io.ReadCloser
- func (r *Resource) ReadSeekCloser() (ReadSeekCloser, bool)
- func (r *Resource) Wrap(rc io.ReadCloser) *Resource
Constants ¶
View Source
const ( // ContentType is for header. ContentType = "Content-Type" // Filename is for header. Filename = "File-Name" )
Variables ¶
View Source
var Mime = map[string]string{
".css": "text/css",
".html": "text/html",
".js": "text/javascript",
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
}
Mime is known MIME table.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options map[string]interface{}
Options holds option properties of Resource.
type ReadSeekCloser ¶
ReadSeekCloser combines io.Reader, io.Seeker and io.Closer.
type Resource ¶
type Resource struct { io.ReadCloser Options }
Resource packs ReadCloser and its meta info.
func NewRedirect ¶ added in v1.12.0
NewRedirect creates a Resource to redirect to another path.
func (*Resource) GuessContentType ¶
GuessContentType guess a content-type from argument string.
func (*Resource) PutContentType ¶
PutContentType puts a content-type option.
func (*Resource) PutFilename ¶
PutFilename puts a filenaem option.
func (*Resource) PutString ¶
PutString puts a string as an option. When value is empty string, it deletes the option.
func (*Resource) Raw ¶
func (r *Resource) Raw() io.ReadCloser
Raw returns underlying io.ReadCloser in this resource.
func (*Resource) ReadSeekCloser ¶
func (r *Resource) ReadSeekCloser() (ReadSeekCloser, bool)
ReadSeekCloser obtains ReadSeekCloser if it could.
Click to show internal directories.
Click to hide internal directories.