context

package
v0.0.0-...-e2a5574 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: LGPL-2.1 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CtxKeyDomainConstraints = contextKey{"domain_constraints"}

Functions

This section is empty.

Types

type Context

type Context interface {
	context.Context

	InnerContext() context.Context
	GetLogger() logging.LoggerService
	SetLogger(logger logging.LoggerService)
	GetDbTranx() db.DbTransaction
	SetDbTranx(trx db.DbTransaction)
	GetDomainConstraints() dmodel.DynamicFields
	SetDomainConstraints(constraints dmodel.DynamicFields)
	GetModuleName() string
	GetPermissions() ContextPermissions
	SetPermissions(permissions ContextPermissions)
	GetUser() dmodel.DynamicFields
	SetUser(user dmodel.DynamicFields)
	// Replace current inner context with a new one that has the given key and value.
	WithValue(key, val any)
}

func AsRequestContext

func AsRequestContext(echoCtx *echo.Context) (Context, error)

Returns pointer to an instance of RequestContext if it exists, otherwise returns an error.

func CloneRequestContext

func CloneRequestContext(ctx Context) Context

func NewRequestContext

func NewRequestContext(ctx context.Context) Context

func NewRequestContextF

func NewRequestContextF(ctx context.Context, moduleName string, domainConstraints dmodel.DynamicFields) Context

func NewRequestContextM

func NewRequestContextM(ctx context.Context, moduleName string) Context

type ContextPermissions

type ContextPermissions struct {
	IsOwner      bool
	Entitlements ds.Set[string]
	UserId       model.Id `json:"user_id"`
	// The orgs that user belongs to (if any)
	UserOrgIds ds.Set[model.Id] `json:"user_org_ids"`
	// The org unit that user belongs to (if any)
	OrgUnitId *model.Id `json:"org_unit_id"`
	// The org that the org unit belongs to (if user belongs to an org unit)
	OrgUnitOrgId *model.Id `json:"org_unit_org_id"`
}

type RequestContext

type RequestContext struct {
	context.Context
	// contains filtered or unexported fields
}

func (RequestContext) GetDbTranx

func (this RequestContext) GetDbTranx() db.DbTransaction

func (RequestContext) GetDomainConstraints

func (this RequestContext) GetDomainConstraints() dmodel.DynamicFields

func (RequestContext) GetLogger

func (this RequestContext) GetLogger() logging.LoggerService

func (RequestContext) GetModuleName

func (this RequestContext) GetModuleName() string

func (RequestContext) GetPermissions

func (this RequestContext) GetPermissions() ContextPermissions

func (RequestContext) GetUser

func (this RequestContext) GetUser() dmodel.DynamicFields

func (RequestContext) InnerContext

func (this RequestContext) InnerContext() context.Context

func (*RequestContext) SetDbTranx

func (this *RequestContext) SetDbTranx(trx db.DbTransaction)

func (*RequestContext) SetDomainConstraints

func (this *RequestContext) SetDomainConstraints(constraints dmodel.DynamicFields)

func (*RequestContext) SetLogger

func (this *RequestContext) SetLogger(logger logging.LoggerService)

func (*RequestContext) SetPermissions

func (this *RequestContext) SetPermissions(permissions ContextPermissions)

func (*RequestContext) SetUser

func (this *RequestContext) SetUser(user dmodel.DynamicFields)

func (*RequestContext) Value

func (this *RequestContext) Value(key any) any

func (*RequestContext) WithValue

func (this *RequestContext) WithValue(key, val any)

Replace current inner context with a new one that has the given key and value.

Jump to

Keyboard shortcuts

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