util

package
v0.0.0-...-f6774a9 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyHighlightTracingDisabled contextKey = "HighlightTracingDisabled"
)
View Source
const KafkaBatchWorkerOp = "KafkaBatchWorker"

Variables

View Source
var (
	OnPrem          = os.Getenv("ON_PREM")
	DopplerConfig   = os.Getenv("DOPPLER_CONFIG")
	InDocker        = os.Getenv("IN_DOCKER")
	InDockerGo      = os.Getenv("IN_DOCKER_GO")
	Version         = os.Getenv("REACT_APP_COMMIT_SHA")
	FrontendUri     = os.Getenv("REACT_APP_FRONTEND_URI")
	PrivateGraphUri = os.Getenv("REACT_APP_PRIVATE_GRAPH_URI")
	PublicGraphUri  = os.Getenv("REACT_APP_PUBLIC_GRAPH_URI")
	LicenseKey      = os.Getenv("LICENSE_KEY")
	SSL             = os.Getenv("SSL")
)

Functions

func ClearTablesInDB

func ClearTablesInDB(db *gorm.DB) error

func CreateAndMigrateTestDB

func CreateAndMigrateTestDB(dbName string) (*gorm.DB, error)

func EnvironmentName

func EnvironmentName() string

func GenerateRandomString

func GenerateRandomString(length int) string

func IsBackendInDocker

func IsBackendInDocker() bool

func IsDevEnv

func IsDevEnv() bool

func IsDevOrTestEnv

func IsDevOrTestEnv() bool

func IsHubspotEnabled

func IsHubspotEnabled() bool

func IsInDocker

func IsInDocker() bool

func IsOnPrem

func IsOnPrem() bool

func IsProduction

func IsProduction() bool

func IsTestEnv

func IsTestEnv() bool

func JsonStringToStringArray

func JsonStringToStringArray(s string) []*string

func Recover

func Recover()

func RecoverAndCrash

func RecoverAndCrash()

func RestRequest

func RestRequest(url string, method string, request interface{}, response interface{}) error

Slim wrapper around sending a request with arbitrary request/response interfaces.

func RunTestWithDBWipe

func RunTestWithDBWipe(t *testing.T, db *gorm.DB, f func(t *testing.T))

func RunTestWithDBWipeWithName

func RunTestWithDBWipeWithName(t *testing.T, db *gorm.DB, name string, f func(t *testing.T))

func StringContainsAnyOf

func StringContainsAnyOf(str string, substrings []string) bool

func UseSSL

func UseSSL() bool

Types

type MultiSpan

type MultiSpan struct {
	// contains filtered or unexported fields
}

func StartSpan

func StartSpan(operationName string, options ...SpanOption) MultiSpan

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, operationName string, options ...SpanOption) (MultiSpan, context.Context)

func (*MultiSpan) Finish

func (s *MultiSpan) Finish(err ...error)

func (*MultiSpan) SetAttribute

func (s *MultiSpan) SetAttribute(key string, value interface{})

func (*MultiSpan) SetOperationName

func (s *MultiSpan) SetOperationName(name string)

type Runtime

type Runtime string
const (
	All          Runtime = "all"
	Worker       Runtime = "worker"
	PublicGraph  Runtime = "public-graph"
	PrivateGraph Runtime = "private-graph"
)

func (Runtime) IsValid

func (lt Runtime) IsValid() bool

type SpanConfig

type SpanConfig struct {
	Tags                     []attribute.KeyValue
	HighlightTracingDisabled bool
	SpanKind                 trace.SpanKind
}

type SpanOption

type SpanOption func(cfg *SpanConfig)

func ResourceName

func ResourceName(name string) SpanOption

func Tag

func Tag(key string, name interface{}) SpanOption

func WithHighlightTracingDisabled

func WithHighlightTracingDisabled(disabled bool) SpanOption

func WithSpanKind

func WithSpanKind(kind trace.SpanKind) SpanOption

type Tracer

type Tracer struct {
	graphql.HandlerExtension
	graphql.ResponseInterceptor
	graphql.FieldInterceptor
	// contains filtered or unexported fields
}

func NewTracer

func NewTracer(backend Runtime) Tracer

func (Tracer) ExtensionName

func (t Tracer) ExtensionName() string

func (Tracer) InterceptField

func (t Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (interface{}, error)

func (Tracer) InterceptResponse

func (t Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response

func (Tracer) Validate

func (t Tracer) Validate(graphql.ExecutableSchema) error

Jump to

Keyboard shortcuts

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