MCPcopy Create free account

hub / github.com/NawafSwe/go-service-starter-kit / functions

Functions465 in github.com/NawafSwe/go-service-starter-kit

↓ 2 callersMethodSQL
SQL returns a safe, validated ORDER BY fragment (e.g. "created_at DESC"). The column is sanitized — only lowercase letters, digits, and underscores ar
internal/db/sqlorder/order.go:20
↓ 2 callersMethodWithLevel
WithLevel returns a new logger filtered to the given minimum level.
internal/observability/logger/logger.go:90
↓ 2 callersFunctionenvOrDefault
(key, def string)
cmd/main.go:117
↓ 2 callersFunctionextractBearerToken
(r *http.Request)
internal/middleware/http.go:101
↓ 2 callersFunctionextractLanguage
(r *http.Request)
internal/middleware/http.go:116
↓ 2 callersFunctionfreeAddr
(t *testing.T)
internal/worker/testhelpers_test.go:15
↓ 2 callersFunctiongrpcBearerToken
grpcBearerToken extracts and validates the Bearer token from incoming gRPC metadata.
internal/middleware/grpc.go:113
↓ 2 callersFunctionmaskedJSON
maskedJSON marshals v after applying go-masker field masking.
internal/middleware/logging.go:84
↓ 2 callersFunctionmustGenerateToken
(t *testing.T, user auth.User)
internal/middleware/http_test.go:20
↓ 2 callersFunctionnewTestLogger
()
internal/gokit/http/http_test.go:36
↓ 2 callersFunctiontoZerologLevel
(level Level)
internal/observability/logger/logger.go:195
↓ 1 callersMethodClamp
Clamp enforces sane bounds: - Number < 1 → 1 - Size < 1 → 20 (default) - Size > maxSize (when maxSize > 0) → maxSize
internal/db/page.go:21
↓ 1 callersMethodComparePassword
(hashedPassword, password string)
internal/auth/password.go:28
↓ 1 callersFunctionConsumerAuthRequired
ConsumerAuthRequired validates a JWT token string extracted from a message header/payload and injects the authenticated user into the context. Returns
internal/middleware/consumer.go:19
↓ 1 callersMethodCreate
(ctx context.Context, params examplerepo.CreateParams)
internal/app/business/example/create.go:24
↓ 1 callersFunctionCreateTestDB
CreateTestDB provisions an isolated PostgreSQL database for a single test. It creates a uniquely-named database, optionally applies migrations, and r
test/pkg/testdb/testdb.go:103
↓ 1 callersMethodDebugW
(ctx context.Context, msg string, fields map[string]any)
internal/observability/logger/logger.go:20
↓ 1 callersMethodDelete
(ctx context.Context, id uuid.UUID)
internal/app/business/example/delete.go:17
↓ 1 callersMethodEncryptPassword
(password string)
internal/auth/password.go:20
↓ 1 callersMethodErrorCode
()
internal/httperrors/bad_request.go:27
↓ 1 callersFunctionFailSpan
FailSpan records err on span and sets its status to Error. Returns err unchanged so callers can write: return tracing.FailSpan(span, err)
internal/observability/tracing/trace.go:126
↓ 1 callersFunctionGRPCAuthOptional
GRPCAuthOptional validates the JWT only when the authorization metadata key is present. RPCs without the header continue unauthenticated — user.ID wil
internal/middleware/grpc.go:42
↓ 1 callersFunctionGRPCLogging
GRPCLogging returns a unary server interceptor that logs every inbound RPC call and any errors the handler returns.
internal/middleware/grpc.go:77
↓ 1 callersFunctionGRPCTracing
GRPCTracing returns a unary server interceptor that starts an OTel span for every call.
internal/middleware/grpc.go:96
↓ 1 callersFunctionGenerateToken
GenerateToken creates a signed JWT token for testing.
test/pkg/suite/option.go:96
↓ 1 callersMethodGetByID
(ctx context.Context, id uuid.UUID)
internal/app/business/example/get.go:20
↓ 1 callersMethodGetName
()
api/proto/grpc/v1/gen/example.pb.go:385
↓ 1 callersMethodGetValue
()
internal/text/nonlogable.go:20
↓ 1 callersMethodGoString
()
internal/text/nonlogable.go:18
↓ 1 callersMethodHandle
(ctx context.Context, err error)
internal/gokit/http/http.go:66
↓ 1 callersFunctionInitializeClients
InitializeClients initialises all external client connections and returns them wrapped in a Dependencies struct.
internal/app/transport/http/bootstrap/client_initializer.go:10
↓ 1 callersFunctionInitializeRepositories
InitializeRepositories wires up and returns the shared repository instances.
internal/app/transport/http/bootstrap/repositories_initializer.go:9
↓ 1 callersFunctionInitializeRepositories
InitializeRepositories wires up and returns the shared repository instances.
internal/app/transport/grpc/bootstrap/repositories_initializer.go:9
↓ 1 callersFunctionInitializeRepositories
InitializeRepositories wires up and returns the shared repository instances.
internal/app/transport/consumer/bootstrap/repositories_initializer.go:9
↓ 1 callersFunctionInitializeRouter
InitializeRouter wires up the message router — one entry per consumed message type. Each entry pairs a transport-layer decode function with a go-kit e
internal/app/transport/consumer/bootstrap/handler_initializer.go:14
↓ 1 callersFunctionInitializeRoutes
InitializeRoutes builds and returns the root mux.Router.
internal/app/transport/http/bootstrap/router_initializer.go:16
↓ 1 callersFunctionInitializeServiceHandler
InitializeServiceHandler wires up and returns the ExampleServiceHandler.
internal/app/transport/grpc/bootstrap/handler_initializer.go:78
↓ 1 callersMethodList
(ctx context.Context)
internal/app/business/example/list.go:17
↓ 1 callersFunctionLoggingGRPCMiddleware
LoggingGRPCMiddleware logs gRPC endpoint processing with masking.
internal/middleware/logging.go:35
↓ 1 callersFunctionLoggingPubSubMiddleware
LoggingPubSubMiddleware logs pub/sub message processing with masking. Attaches topic and transport attributes to every log line.
internal/middleware/logging.go:16
↓ 1 callersFunctionNewBadRequestError
(message string)
internal/httperrors/bad_request.go:36
↓ 1 callersFunctionNewBadRequestErrorWithCode
(message, code string)
internal/httperrors/bad_request.go:40
↓ 1 callersFunctionNewConflictError
(message string)
internal/httperrors/conflict.go:26
↓ 1 callersFunctionNewConn
NewConn creates a MySQL connection pool. By default, no tracing is applied. Use WithTracerProvider to enable OTel-traced queries. DSN format: user:pas
internal/clients/db/mysql/db.go:38
↓ 1 callersFunctionNewConsumerProcess
()
cmd/app/consumer.go:17
↓ 1 callersFunctionNewDeadlineError
()
internal/middleware/gokit.go:19
↓ 1 callersFunctionNewExampleServiceHandler
( createHandler grpctransport.Handler, getHandler grpctransport.Handler, listHandler grpctransport.Handler,
internal/app/transport/grpc/v1/example_handler.go:21
↓ 1 callersFunctionNewForbiddenError
(message string)
internal/httperrors/forbidden.go:26
↓ 1 callersFunctionNewGRPCServerProcess
()
cmd/app/grpc.go:17
↓ 1 callersFunctionNewHTTPServerProcess
()
cmd/app/http.go:17
↓ 1 callersFunctionNewLogErrorHandler
(lgr logger.Logger)
internal/gokit/http/http.go:62
↓ 1 callersFunctionNewLogErrorHandler
(lgr logger.Logger)
internal/gokit/grpc/grpc.go:36
↓ 1 callersFunctionNewPageResult
NewPageResult computes PageResult from a clamped Page and a total count.
internal/db/page.go:43
↓ 1 callersFunctionNewPasswordGenerator
()
internal/auth/password.go:16
↓ 1 callersFunctionNewReporter
NewReporter registers the service-level metric instruments on the provided meter.
internal/observability/metric/metric.go:23
↓ 1 callersFunctionNewSharedResource
NewSharedResource creates a SharedResource with the required logger and optional observability concerns. Without any options, tracing and metrics are
internal/app/transport/http/bootstrap/di_container.go:36
↓ 1 callersFunctionNewSharedResource
NewSharedResource creates a SharedResource with the required logger and optional observability concerns. Without any options, tracing is disabled.
internal/app/transport/grpc/bootstrap/di_container.go:33
↓ 1 callersFunctionNewUnauthorizedError
(message string)
internal/httperrors/unauthorized.go:26
↓ 1 callersMethodOffset
Offset derives the SQL OFFSET value for this page.
internal/db/page.go:10
↓ 1 callersFunctionParseDSN
ParseDSN parses a PostgreSQL DSN into a DBConfig.
test/pkg/testdb/testdb.go:45
↓ 1 callersMethodRecordRequest
RecordRequest increments the request counter with the provided attributes. Avoid high-cardinality attributes (user IDs, session IDs) to prevent metric
internal/observability/metric/metric.go:37
↓ 1 callersFunctionRegisterV1Routes
RegisterV1Routes registers all v1 API routes on the provided router. Route layout: - /api/v1/examples GET, POST (auth required) - /api/v1/
internal/app/transport/http/bootstrap/router_v1_register.go:17
↓ 1 callersMethodRun
(ctx context.Context)
internal/worker/consumer.go:44
↓ 1 callersMethodSchedule
(args ProcessArgs)
cmd/app/job.go:6
↓ 1 callersFunctionStartSpan
StartSpan is a convenience helper that starts a named span on the global tracer. The caller is responsible for calling span.End(). ctx, span := trac
internal/observability/tracing/trace.go:114
↓ 1 callersMethodUnwrap
()
internal/httperrors/processing.go:19
↓ 1 callersMethodWarn
(ctx context.Context, msg string)
internal/observability/logger/logger.go:23
↓ 1 callersMethodWarnW
(ctx context.Context, msg string, fields map[string]any)
internal/observability/logger/logger.go:24
↓ 1 callersMethodWithCallerSkip
WithCallerSkip returns a new logger with an adjusted caller frame offset. Use this when wrapping ZerologLogger in another logger type.
internal/observability/logger/logger.go:120
↓ 1 callersFunctionWithClaimsParserTTL
WithClaimsParserTTL overrides the default token TTL.
internal/auth/jwt.go:33
↓ 1 callersMethodWithHost
WithHost returns a new logger with the host field set.
internal/observability/logger/logger.go:84
↓ 1 callersFunctionWithMeter
WithMeter enables runtime metrics collection on the HTTP server.
internal/app/transport/http/bootstrap/di_container.go:50
↓ 1 callersFunctionWithMeterProvider
WithMeterProvider sets the OTel MeterProvider on the HTTP server.
internal/app/transport/http/bootstrap/di_container.go:55
↓ 1 callersMethodWithPrettyOutput
WithPrettyOutput returns a new logger with human-readable console output. Use this in local development; JSON output is better in production.
internal/observability/logger/logger.go:106
↓ 1 callersFunctionWithTracer
WithTracer enables distributed tracing on the HTTP server.
internal/app/transport/http/bootstrap/di_container.go:45
↓ 1 callersFunctionWithTracer
WithTracer enables distributed tracing on the gRPC server.
internal/app/transport/grpc/bootstrap/di_container.go:42
↓ 1 callersFunctionWithTracerProvider
WithTracerProvider enables OTel tracing on all SQL operations.
internal/clients/db/mysql/db.go:29
↓ 1 callersFunctionapplyContextFields
(ctx context.Context, event *zerolog.Event)
internal/observability/logger/logger.go:185
↓ 1 callersFunctionapplyMigrations
applyMigrations runs all up migrations against the given database.
test/pkg/testdb/testdb.go:163
↓ 1 callersFunctionbuildConfig
(opts ...Option)
test/pkg/testdb/testdb.go:148
↓ 1 callersFunctionbuildLogAttrs
buildLogAttrs marshals request and response with sensitive-field masking applied.
internal/middleware/logging.go:65
↓ 1 callersFunctionchooseAuthMiddleware
chooseAuthMiddleware selects the right JWT middleware based on config.
internal/app/transport/consumer/consumer.go:128
↓ 1 callersFunctiondefaultParser
(t *testing.T)
internal/auth/jwt_test.go:18
↓ 1 callersFunctiondomainErrorCode
(err error)
internal/app/transport/http/encoder/json_error_encoder.go:57
↓ 1 callersFunctionfile_example_proto_init
()
api/proto/grpc/v1/gen/example.pb.go:516
↓ 1 callersFunctionfindMigrationsDir
findMigrationsDir walks upward from the working directory looking for db/migrations (the project convention).
test/pkg/testdb/testdb.go:190
↓ 1 callersFunctionfindProjectRoot
findProjectRoot walks upward from the working directory looking for go.mod (the project root marker). This avoids brittle hardcoded relative paths tha
test/pkg/suite/suite.go:80
↓ 1 callersFunctioninitializeCreateExampleHandler
( cfg config.Config, lgr logger.Logger, repos *SharedRepositories, )
internal/app/transport/http/bootstrap/handler_initializer.go:16
↓ 1 callersFunctioninitializeCreateExampleHandler
( cfg config.Config, resources *SharedResource, repos *SharedRepositories, )
internal/app/transport/grpc/bootstrap/handler_initializer.go:13
↓ 1 callersFunctioninitializeDeleteExampleHandler
( cfg config.Config, lgr logger.Logger, repos *SharedRepositories, )
internal/app/transport/http/bootstrap/handler_initializer.go:70
↓ 1 callersFunctioninitializeDeleteExampleHandler
( cfg config.Config, resources *SharedResource, repos *SharedRepositories, )
internal/app/transport/grpc/bootstrap/handler_initializer.go:61
↓ 1 callersFunctioninitializeGetExampleHandler
( cfg config.Config, lgr logger.Logger, repos *SharedRepositories, )
internal/app/transport/http/bootstrap/handler_initializer.go:34
↓ 1 callersFunctioninitializeGetExampleHandler
( cfg config.Config, resources *SharedResource, repos *SharedRepositories, )
internal/app/transport/grpc/bootstrap/handler_initializer.go:29
↓ 1 callersFunctioninitializeListExamplesHandler
( cfg config.Config, lgr logger.Logger, repos *SharedRepositories, )
internal/app/transport/http/bootstrap/handler_initializer.go:52
↓ 1 callersFunctioninitializeListExamplesHandler
( cfg config.Config, resources *SharedResource, repos *SharedRepositories, )
internal/app/transport/grpc/bootstrap/handler_initializer.go:45
↓ 1 callersFunctioninvokeMethod
(methodName, data, metadata)
test/load/pkg/grpc/client.js:30
↓ 1 callersFunctionisCanceledError
(ctx context.Context, err error)
internal/app/transport/http/encoder/json_error_encoder.go:74
↓ 1 callersFunctionjitterBackoff
(min, max time.Duration, attempt int)
internal/httpx/client.go:165
↓ 1 callersFunctionjitterBackoff
(min, max time.Duration, attempt int)
internal/grpcx/client.go:137
↓ 1 callersFunctionmeter
(name string, opts ...otelmeter.MeterOption)
cmd/main.go:113
← previousnext →101–200 of 465, ranked by callers