本文整理汇总了Golang中gitlab.com/leanlabsio/kanban/modules/middleware.Context.Query方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.Query方法的具体用法?Golang Context.Query怎么用?Golang Context.Query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gitlab.com/leanlabsio/kanban/modules/middleware.Context
的用法示例。
在下文中一共展示了Context.Query方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ListMembers
// ListMembers gets a list of member on board accessible by the authenticated user.
func ListMembers(ctx *middleware.Context) {
members, err := ctx.DataSource.ListMembers(ctx.Query("project_id"))
if err != nil {
ctx.JSON(http.StatusUnauthorized, &models.ResponseError{
Success: false,
Message: err.Error(),
})
return
}
ctx.JSON(http.StatusOK, members)
}
示例2: ListLabels
// ListLabels gets a list of label on board accessible by the authenticated user.
func ListLabels(ctx *middleware.Context) {
labels, err := models.ListLabels(ctx.User, ctx.Provider, ctx.Query("board_id"))
if err != nil {
ctx.JSON(http.StatusUnauthorized, &models.ResponseError{
Success: false,
Message: err.Error(),
})
return
}
ctx.JSON(http.StatusOK, &models.Response{
Data: labels,
})
}
示例3: ListComments
// ListComments gets a list of comment on board and card
// accessible by the authenticated user.
func ListComments(ctx *middleware.Context) {
boards, err := models.ListComments(ctx.User, ctx.Provider, ctx.Query("project_id"), ctx.Query("issue_id"))
if err != nil {
ctx.JSON(http.StatusUnauthorized, &models.ResponseError{
Success: false,
Message: err.Error(),
})
return
}
ctx.JSON(http.StatusOK, &models.Response{
Data: boards,
})
}
示例4: ItemBoard
// ItemBoard gets a specific board, identified by project ID or
// NAMESPACE/BOARD_NAME, which is owned by the authenticated user.
func ItemBoard(ctx *middleware.Context) {
board, err := models.ItemBoard(ctx.User, ctx.Provider, ctx.Query("project_id"))
if err != nil {
if err, ok := err.(models.ReceivedDataErr); ok {
ctx.JSON(err.StatusCode, &models.ResponseError{
Success: false,
Message: err.Error(),
})
}
ctx.JSON(http.StatusInternalServerError, &models.ResponseError{
Success: false,
Message: err.Error(),
})
return
}
ctx.JSON(http.StatusOK, &models.Response{
Data: board,
})
}
示例5: OauthUrl
// OauthUrl redirects to url for authorisation
func OauthUrl(ctx *middleware.Context) {
ctx.Redirect(models.AuthCodeURL(ctx.Query("provider")))
}