Documentation
¶
Index ¶
- type CTX
- type Context
- func (c *Context) AcceptLanguage() string
- func (c *Context) Context() context.Context
- func (c *Context) GetT() i18n.TranslateFunc
- func (c *Context) IPAddress() string
- func (c *Context) Logger() mlog.LoggerIFace
- func (c *Context) Path() string
- func (c *Context) RequestId() string
- func (c *Context) Session() *model.Session
- func (c *Context) T(translationID string, args ...any) string
- func (c *Context) UserAgent() string
- func (c *Context) With(f func(ctx CTX) CTX) CTX
- func (c *Context) WithAcceptLanguage(s string) CTX
- func (c *Context) WithContext(ctx context.Context) CTX
- func (c *Context) WithIPAddress(s string) CTX
- func (c *Context) WithLogger(logger mlog.LoggerIFace) CTX
- func (c *Context) WithPath(s string) CTX
- func (c *Context) WithRequestId(s string) CTX
- func (c *Context) WithSession(s *model.Session) CTX
- func (c *Context) WithT(t i18n.TranslateFunc) CTX
- func (c *Context) WithUserAgent(s string) CTX
- func (c *Context) WithXForwardedFor(s string) CTX
- func (c *Context) XForwardedFor() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CTX ¶
type CTX interface { T(string, ...interface{}) string GetT() i18n.TranslateFunc Session() *model.Session RequestId() string IPAddress() string XForwardedFor() string Path() string UserAgent() string AcceptLanguage() string Logger() mlog.LoggerIFace Context() context.Context WithT(i18n.TranslateFunc) CTX WithSession(s *model.Session) CTX WithRequestId(string) CTX WithIPAddress(string) CTX WithXForwardedFor(string) CTX WithPath(string) CTX WithUserAgent(string) CTX WithAcceptLanguage(string) CTX WithLogger(mlog.LoggerIFace) CTX WithContext(ctx context.Context) CTX With(func(ctx CTX) CTX) CTX }
CTX should be abbreviated as `rctx`.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context should be abbreviated as `rctx`.
func EmptyContext ¶
func EmptyContext(logger mlog.LoggerIFace) *Context
func NewContext ¶
func TestContext ¶ added in v0.0.10
TestContext creates an empty context with a new logger to use in testing where a test helper is not required.
func (*Context) AcceptLanguage ¶
func (*Context) GetT ¶
func (c *Context) GetT() i18n.TranslateFunc
func (*Context) Logger ¶
func (c *Context) Logger() mlog.LoggerIFace
func (*Context) WithAcceptLanguage ¶ added in v0.0.10
func (*Context) WithContext ¶ added in v0.0.10
func (*Context) WithIPAddress ¶ added in v0.0.10
func (*Context) WithLogger ¶ added in v0.0.10
func (c *Context) WithLogger(logger mlog.LoggerIFace) CTX
func (*Context) WithRequestId ¶ added in v0.0.10
func (*Context) WithUserAgent ¶ added in v0.0.10
func (*Context) WithXForwardedFor ¶ added in v0.0.10
func (*Context) XForwardedFor ¶
Click to show internal directories.
Click to hide internal directories.