renderer

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSV

func CSV(ctx context.Context, w http.ResponseWriter, name string, data [][]string)

CSV ... CSV(UTF8)をレンダリングする

func CSVByShiftJIS

func CSVByShiftJIS(ctx context.Context, w http.ResponseWriter, name string, data [][]string)

CSVByShiftJIS ... CSV(ShiftJIS)をレンダリングする

func Error

func Error(ctx context.Context, w http.ResponseWriter, status int, msg string)

Error ... エラーレスポンスをレンダリングする

func HTML

func HTML(ctx context.Context, w http.ResponseWriter, status int, name string, values any)

HTML ... HTMLをレンダリングする

func HandleError

func HandleError(ctx context.Context, w http.ResponseWriter, err error)

HandleError ... よく使うエラーハンドリング

func JSON

func JSON(ctx context.Context, w http.ResponseWriter, status int, v any)

JSON ... JSONをレンダリングする

func Success

func Success(ctx context.Context, w http.ResponseWriter)

Success ... 成功レスポンスをレンダリングする

func Text

func Text(ctx context.Context, w http.ResponseWriter, status int, body string)

Text ... テキストをレンダリングする

Types

type ResponseError

type ResponseError struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

ResponseError ... エラーレスポンス

func NewResponseError

func NewResponseError(status int, message string) *ResponseError

NewResponseError ... エラーレスポンスを取得する

type ResponseOK

type ResponseOK struct {
	Status int `json:"status"`
}

ResponseOK ... 成功レスポンス

func NewResponseOK

func NewResponseOK(status int) *ResponseOK

NewResponseOK ... 成功レスポンスを取得する

Jump to

Keyboard shortcuts

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