gin_json_cr

package module
v0.0.0-...-9b60c3b Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 3 Imported by: 0

README

gin-json-cr

JSON render for Gin with carriage return

Installation

    go get github.com/amonsat/gin-json-cr

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndentedJSON

func IndentedJSON(c *gin.Context, code int, obj interface{})

func JSON

func JSON(c *gin.Context, code int, obj interface{})

func WriteJSON

func WriteJSON(w http.ResponseWriter, obj interface{}) error

WriteJSON marshals the given interface object and writes it with custom ContentType.

Types

type IndentedJsonRender

type IndentedJsonRender struct {
	Data interface{}
}

IndentedJSON contains the given interface object.

func (IndentedJsonRender) Render

func (r IndentedJsonRender) Render(w http.ResponseWriter) (err error)

Render writes data with custom ContentType.

func (IndentedJsonRender) WriteContentType

func (r IndentedJsonRender) WriteContentType(w http.ResponseWriter)

WriteContentType writes custom ContentType.

type JsonRender

type JsonRender struct {
	Data interface{}
}

func (JsonRender) Render

func (r JsonRender) Render(w http.ResponseWriter) (err error)

Render writes data with custom ContentType.

func (JsonRender) WriteContentType

func (r JsonRender) WriteContentType(w http.ResponseWriter)

WriteContentType writes custom ContentType.

Jump to

Keyboard shortcuts

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