webcontext

package
v1.3.0-rc.0...-d217119 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

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

func WithEtcdClient(client *clientv3.Client)

func WithI18n

func WithI18n(i18n i18n.Translator)

func WithOrgClient

func WithOrgClient(org org.ClientInterface)

func WithTokenService

func WithTokenService(tokenService *tokenpb.TokenServiceServer)

func WithUCAuth

func WithUCAuth(ucAuth *uc.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      *uc.UCUserAuth

	EtcdClient   *clientv3.Client
	TokenService tokenpb.TokenServiceServer
	// 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) GetOrg

func (c *Context) GetOrg(orgID interface{}) (*orgpb.Org, error)

func (*Context) GetOrgByDomain

func (c *Context) GetOrgByDomain(domain, userID string) (*orgpb.Org, error)

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