bdxctx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context はハンドラへ渡される属性

func New

func New(engine interfaces.Engine, params *param.Params) *Context

New Context Constructor

func (*Context) Abort

func (c *Context) Abort()

Abort 後続を処理せず`この処理`で終了

func (*Context) AbortWithStatusAndMessage

func (c *Context) AbortWithStatusAndMessage(status int, buf []byte)

AbortWithStatusAndMessage 後続を処理せず`この処理`で終了し、エラーレスポンスを生成

func (*Context) AbortWithUnsupportedMediaType

func (c *Context) AbortWithUnsupportedMediaType()

AbortWithUnsupportedMediaType 後続を処理せず`この処理`で終了し、エラーレスポンスを生成

func (*Context) DefaultPostForm

func (c *Context) DefaultPostForm(key, defaultValue string) string

DefaultPostForm POST urlencoded form or multipart formが存在すればそれを返します。 存在しない場合は`defaultValue`に設定された値を返します。

POST /path
Content-Type: application/x-www-from-urlencoded

name=hoge
c.DefaultPostForm("id", "123") == "123"
c.DefaultPostForm("name", "none") == "hoge"

func (*Context) DefaultQuery

func (c *Context) DefaultQuery(key, defaultValue string) string

DefaultQuery url parameterが存在すればそれを返します。 存在しない場合は`defaultValue`に設定された値を返します。

GET /path?id=1&name=hoge&value=
c.DefaultQuery("id", "123") == "1"
c.DefaultQuery("name", "none") == "hoge"

func (*Context) GetPostForm

func (c *Context) GetPostForm(key string) (string, bool)

GetPostForm POST urlencoded form or multipart formすればそれを返し、さらに`true`を返します。 存在しない場合は空文字を返し、`false`も返します。

func (*Context) GetPostFormArray

func (c *Context) GetPostFormArray(key string) ([]string, bool)

GetPostFormArray POST urlencoded form or multipart formが存在すれば複数の値をを返し、さらに`true`も返します。 存在しない場合は空の文字列配列と`false`を返します。

func (*Context) GetQuery

func (c *Context) GetQuery(key string) (string, bool)

GetQuery url parameterが存在すればそれを返し、さらに`true`を返します。 存在しない場合は空文字を返し、`false`も返します。

func (*Context) GetQueryArray

func (c *Context) GetQueryArray(key string) ([]string, bool)

GetQueryArray url parameterが存在すれば複数の値をを返し、さらに`true`も返します。 存在しない場合は空の文字列配列と`false`を返します。

func (*Context) Handler

func (c *Context) Handler() interfaces.BdxHandlerFunc

Handler 実際に登録されているハンドラ

func (*Context) IsAborted

func (c *Context) IsAborted() bool

IsAborted はどこかで終了処理が呼び出されたかどうか

func (*Context) JSON

func (c *Context) JSON(code int, data interface{})

JSON JSONでHTTP responseを書き込み

func (*Context) Logger

func (c *Context) Logger() logger.ILogger

Logger `logger.Logger`

func (*Context) Next

func (c *Context) Next()

Next は次のミドルウェアもしくはハンドラを実行

func (*Context) Params

func (c *Context) Params() param.Params

Params URIパス パラメータ

func (*Context) PostForm

func (c *Context) PostForm(key string) string

PostForm POST urlencoded form or multipart formが存在すればそれを返します。 存在しない場合は空文字を返します。

POST /path
Content-Type: application/x-www-from-urlencoded

id=1&name=hoge
c.PostForm("id") == "1"
c.PostForm("name") == "hogehoe"
c.PostForm("value") == ""
c.PostForm("foo") == ""

func (*Context) PostFormArray

func (c *Context) PostFormArray(key string) []string

PostFormArray POST urlencoded form or multipart formが存在すれば複数の値をを返します。 存在しない場合は空の文字列配列を返します。

func (*Context) Query

func (c *Context) Query(key string) string

Query url parameterが存在すればそれを返します。 存在しない場合は空文字を返します。 これは`c.Request.URL.Query().Get(key)`のショートカットと同じです。

GET /path?id=1&name=hoge&value=
c.Query("id") == "1"
c.Query("name") == "hogehoe"
c.Query("value") == ""
c.Query("foo") == ""

func (*Context) QueryArray

func (c *Context) QueryArray(key string) []string

QueryArray url parameterが存在すれば複数の値をを返します。 存在しない場合は空の文字列配列を返します。

func (*Context) Render

func (c *Context) Render(code int, r render.Render)

Render HTTTP response codeと`render.Render`にrender dataを書き込みます

func (*Context) Request

func (c *Context) Request() *http.Request

Request `*http.Request`

func (*Context) Reset

func (c *Context) Reset(response http.ResponseWriter, request *http.Request)

Reset .

func (*Context) Response

func (c *Context) Response() http.ResponseWriter

Response `http.ResponseWriter`

func (*Context) SetHandler

func (c *Context) SetHandler(handlers interfaces.HandlersChain)

SetHandler ハンドラー設定

func (*Context) SetLogger

func (c *Context) SetLogger(log logger.ILogger)

SetLogger `logger.Logger`

func (*Context) SetParams

func (c *Context) SetParams(params *param.Params)

SetParams paramsをセット

func (*Context) SetRequest

func (c *Context) SetRequest(req *http.Request)

SetRequest `*http.Request`

func (*Context) SetResponse added in v0.1.0

func (c *Context) SetResponse(write http.ResponseWriter)

SetResponse `http.ResponseWriter`

func (*Context) Status

func (c *Context) Status(code int)

Status HTTP response codeを設定

func (*Context) XML

func (c *Context) XML(code int, data interface{})

XML XMLでHTTP responseを書き込み

func (*Context) YAML

func (c *Context) YAML(code int, data interface{})

YAML YAMLでHTTP responseを書き込み

Jump to

Keyboard shortcuts

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