MM-45039 create mctx package (#20505)
Thanks to @agnivade and @isacikgoz for their input
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f4dcffd8d3
Коммит
49bd76632b
@@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/mattermost/mattermost-server/v6/model"
|
"github.com/mattermost/mattermost-server/v6/model"
|
||||||
"github.com/mattermost/mattermost-server/v6/shared/i18n"
|
"github.com/mattermost/mattermost-server/v6/shared/i18n"
|
||||||
|
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Context struct {
|
type Context struct {
|
||||||
@@ -18,6 +19,8 @@ type Context struct {
|
|||||||
path string
|
path string
|
||||||
userAgent string
|
userAgent string
|
||||||
acceptLanguage string
|
acceptLanguage string
|
||||||
|
logger mlog.LoggerIFace
|
||||||
|
err *model.AppError
|
||||||
|
|
||||||
context context.Context
|
context context.Context
|
||||||
}
|
}
|
||||||
@@ -97,3 +100,19 @@ func (c *Context) SetContext(ctx context.Context) {
|
|||||||
func (c *Context) GetT() i18n.TranslateFunc {
|
func (c *Context) GetT() i18n.TranslateFunc {
|
||||||
return c.t
|
return c.t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Context) SetLogger(logger mlog.LoggerIFace) {
|
||||||
|
c.logger = logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) Logger() mlog.LoggerIFace {
|
||||||
|
return c.logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) SetAppError(err *model.AppError) {
|
||||||
|
c.err = err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) AppError() *model.AppError {
|
||||||
|
return c.err
|
||||||
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user