webcontext

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithBundle

func WithBundle(diceBundle *bundle.Bundle)

func WithDB

func WithDB(db *models.DBClient)

func WithEtcdClient added in v1.3.0

func WithEtcdClient(client *clientv3.Client)

func WithUCAuth

func WithUCAuth(ucAuth *ucauth.UCUserAuth)

func WrapHandler

func WrapHandler(handlerFunc ContextHandlerFunc) echo.HandlerFunc

func WrapHandlerWithRepoCheck

func WrapHandlerWithRepoCheck(handlerFunc ContextHandlerFunc) echo.HandlerFunc

func WrapMiddlewareHandler

func WrapMiddlewareHandler(handlerFunc ContextHandlerFunc) echo.MiddlewareFunc

Types

type ApiData

type ApiData struct {
	Success bool        `json:"success"`
	Err     interface{} `json:"err"`
	Data    interface{} `json:"data"`
	UserIDs []string    `json:"userIDs,omitempty"`
}

type Context

type Context struct {
	EchoContext echo.Context
	Repository  *gitmodule.Repository
	User        *models.User
	Service     *models.Service
	DBClient    *models.DBClient
	Bundle      *bundle.Bundle
	UCAuth      *ucauth.UCUserAuth

	EtcdClient *clientv3.Client
	// contains filtered or unexported fields
}

func NewEchoContext

func NewEchoContext(c echo.Context, db *models.DBClient) *Context

func (*Context) Abort

func (c *Context) Abort(err error)

func (*Context) AbortWithData

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

func (*Context) AbortWithStatus

func (c *Context) AbortWithStatus(code int, err ...error)

func (*Context) AbortWithString

func (c *Context) AbortWithString(code int, msg string)

func (*Context) BasicAuth

func (c *Context) BasicAuth() (username, password string, ok bool)

func (*Context) BindJSON

func (c *Context) BindJSON(obj interface{}) error

func (*Context) CheckBranchOperatePermission

func (c *Context) CheckBranchOperatePermission(user *models.User, branch string) error

func (*Context) CheckPermission

func (c *Context) CheckPermission(permission models.Permission) error

func (*Context) CheckPermissionWithRole

func (c *Context) CheckPermissionWithRole(permission models.Permission, resourceRoleList []string) error

func (*Context) Data

func (c *Context) Data(statusCode int, contentType string, buf []byte)

func (*Context) File

func (c *Context) File(path string)

func (*Context) GetHeader

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

func (*Context) GetQueryBool

func (c *Context) GetQueryBool(key string, defaults ...bool) bool

func (*Context) GetQueryInt32

func (c *Context) GetQueryInt32(key string, defaults ...int) int

func (*Context) GetRequestBody

func (c *Context) GetRequestBody() io.ReadCloser

func (*Context) GetWriter

func (c *Context) GetWriter() io.Writer

func (*Context) Header

func (c *Context) Header(key string, value string)

func (*Context) Host

func (c *Context) Host() string

func (*Context) HttpRequest

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

func (*Context) MustGet

func (c *Context) MustGet(key string) interface{}

func (*Context) Next

func (c *Context) Next()

func (*Context) Param

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

func (*Context) ParamInt32

func (c *Context) ParamInt32(key string, defaults ...int) int

func (*Context) Query

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

func (*Context) Set

func (c *Context) Set(key string, value interface{})

func (*Context) Status

func (c *Context) Status(status int)

func (*Context) Success

func (c *Context) Success(data interface{}, userIDs ...[]string)

type ContextHandlerFunc

type ContextHandlerFunc func(*Context)

Jump to

Keyboard shortcuts

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