Files
isp-gate-service/domain/endpoint_meta.go
txix 394bbc82e2
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-04-06 15:36:37: merge [main:48e53159863d08bc31c4e926d73c0bb4341128ae];
2026-04-06 15:36:37 +03:00

32 lines
863 B
Go

package domain
import (
"context"
)
type EndpointMeta struct {
Inner bool
UserAuthRequired bool
ModuleName string
RequiredAdminPermission string
// Объявляемый сервисом метод
PathSchema string
// Вызываемый метод
Endpoint string
// Нормализованный путь, для известных путей берётся объявляемый метод, для неизвестных - вызываемый
// Удаляет '/' из начала пути
NormalizedEndpoint string
}
type endpointMetaKey struct{}
func (m EndpointMeta) ToContext(ctx context.Context) context.Context {
return context.WithValue(ctx, endpointMetaKey{}, m)
}
func EndpointMetaFromContext(ctx context.Context) EndpointMeta {
meta, _ := ctx.Value(endpointMetaKey{}).(EndpointMeta)
return meta
}