ginServer

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const StatusNotModified = 304 // RFC 7232, 4.1
View Source
const TimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"

Variables

View Source
var Router *gin.Engine

Functions

func AddRouterGroup

func AddRouterGroup(group string, route string, method string, fp func(*gin.Context))

func CheckLastModified

func CheckLastModified(w http.ResponseWriter, r *http.Request, modtime time.Time) bool

modtime is the modification time of the resource to be served, or IsZero(). return value is whether this request is now complete.

func ClearSession

func ClearSession(c *gin.Context)

func GetRequestBody

func GetRequestBody(c *gin.Context) ([]byte, error)

func GetSessionKey

func GetSessionKey(c *gin.Context, key string) (sessionKey string)

func Initialize

func Initialize(mode string, cookieDomain string)

func InitializeLite

func InitializeLite(mode string)

func ReadFileBase64

func ReadFileBase64(path string, c *gin.Context)

Reads a file and responds with a base64 encoded string. Primarily used for jquery ajax response binary data blob encoding.

func ReadGzipCSSFile

func ReadGzipCSSFile(path string, c *gin.Context)

func ReadGzipJSFile

func ReadGzipJSFile(path string, c *gin.Context)

func ReadHTMLFile

func ReadHTMLFile(path string, c *gin.Context)

Reads a file from the path parameter and returns to the client as text/html.

func ReadJSFile

func ReadJSFile(path string, c *gin.Context)

func ReadJSONFile

func ReadJSONFile(path string, c *gin.Context)

Reads a file from the path parameter and returns to the client application/json

func ReadJpgFile

func ReadJpgFile(path string, c *gin.Context)

func ReadPngFile

func ReadPngFile(path string, c *gin.Context)

func RenderHTML

func RenderHTML(html string, c *gin.Context)

Takes a string and returns to the client as text/html.

func RespondEotFile

func RespondEotFile(data []byte, modTime time.Time, c *gin.Context)

func RespondError

func RespondError(message string) []byte

Returns an byte array comprised of a JSON formated object with the error message.

func RespondGzipCSSFile

func RespondGzipCSSFile(data []byte, modTime time.Time, c *gin.Context)

func RespondGzipJSFile

func RespondGzipJSFile(data []byte, modTime time.Time, c *gin.Context)

func RespondJSFile

func RespondJSFile(data []byte, modTime time.Time, c *gin.Context)

func RespondJSON

func RespondJSON(v interface{}, c *gin.Context)

Returns to the client application/json format for the passed interface.

func RespondOtfFile

func RespondOtfFile(data []byte, modTime time.Time, c *gin.Context)

func RespondSvgFile

func RespondSvgFile(data []byte, modTime time.Time, c *gin.Context)

func RespondTtfFile

func RespondTtfFile(data []byte, modTime time.Time, c *gin.Context)

func RespondWoff2File

func RespondWoff2File(data []byte, modTime time.Time, c *gin.Context)

func RespondWoffFile

func RespondWoffFile(data []byte, modTime time.Time, c *gin.Context)

func SaveSession

func SaveSession(c *gin.Context)

func SetSessionKey

func SetSessionKey(c *gin.Context, key string, value string)

Types

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

type LocaleLanguage

type LocaleLanguage struct {
	Locale   string
	Language string
}

func GetLocaleLanguage

func GetLocaleLanguage(c *gin.Context) (ll LocaleLanguage)

Jump to

Keyboard shortcuts

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