render

package
v0.0.0-...-c6ea6ab Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body interface {
	// GetBody return response body data
	GetBody() []byte
	// GetSize return response body size, not equal to len(GetBody()) because GetBody() exist only if BufferResponse flag set
	GetSize() int64
}

Body interface for get http response body instance

type CacheControl

type CacheControl interface {
	// SetCacheControl set response cache-control header
	SetCacheControl(ctype CacheControlType, maxAge time.Duration)
}

CacheControl interface for set response cache-control header

type CacheControlType

type CacheControlType int8

CacheControlType main enum type

const (
	CacheControlNoStore CacheControlType = 1 + iota
	CacheControlNoCache
	CacheControlPrivate
	CacheControlPublic
)

List all valid enum

func (CacheControlType) String

func (t CacheControlType) String() string

type ContentType

type ContentType interface {
	// SetContentType set response content-type header
	SetContentType(ctype string)
}

ContentType interface for set response content-type header

type Cookie interface {
	// SetCookie adds a Set-Cookie header to the provided ResponseWriter's headers.
	SetCookie(cookie *http.Cookie)
}

Cookie interface for handling http cookie to response

type Error

type Error interface {
	// Error write error to response
	Error(err error)
	// GetError return error for the last Error() called
	GetError() error
}

Error interface for render Error to response

type JSON

type JSON interface {
	// JSON render object to response in JSON format
	JSON(obj interface{})
}

JSON interface for render JSON object to response

type LastModified

type LastModified interface {
	// LastModified set last-modified header in response and check if-modified-since header in request, return true if header match
	LastModified(ts time.Time) (notModified bool)
}

LastModified interface handle http last modified feature

type Redirect

type Redirect interface {
	// Redirect http request to location with status code
	Redirect(status int, location string)
}

Redirect http request to location with status code

type Request

type Request interface {
	// GetRequest return http request instance
	GetRequest() *http.Request
}

Request interface for get http request instance

type Response

type Response interface {
	// GetResponseHeader return http response header
	GetResponseHeader() http.Header
	// GetResponseWriter return http response writer interface
	GetResponseWriter() http.ResponseWriter
}

Response interface for get http response instance

type Status

type Status interface {
	// GetStatus return response status code
	GetStatus() int
}

Status interface for get status from Render which already set before

type Write

type Write interface {
	// WriteResponse write data to response, use JSON/Error instead if possible
	WriteResponse(header http.Header, status int, data interface{})
	// IsWritten return true if already write something
	IsWritten() bool
}

Write interface for Render custom data, low level API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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