Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/NawafSwe/go-service-starter-kit
/ functions
Functions
465 in github.com/NawafSwe/go-service-starter-kit
⨍
Functions
465
◇
Types & classes
154
↓ 2 callers
Method
SQL
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 callers
Method
WithLevel
WithLevel returns a new logger filtered to the given minimum level.
internal/observability/logger/logger.go:90
↓ 2 callers
Function
envOrDefault
(key, def string)
cmd/main.go:117
↓ 2 callers
Function
extractBearerToken
(r *http.Request)
internal/middleware/http.go:101
↓ 2 callers
Function
extractLanguage
(r *http.Request)
internal/middleware/http.go:116
↓ 2 callers
Function
freeAddr
(t *testing.T)
internal/worker/testhelpers_test.go:15
↓ 2 callers
Function
grpcBearerToken
grpcBearerToken extracts and validates the Bearer token from incoming gRPC metadata.
internal/middleware/grpc.go:113
↓ 2 callers
Function
maskedJSON
maskedJSON marshals v after applying go-masker field masking.
internal/middleware/logging.go:84
↓ 2 callers
Function
mustGenerateToken
(t *testing.T, user auth.User)
internal/middleware/http_test.go:20
↓ 2 callers
Function
newTestLogger
()
internal/gokit/http/http_test.go:36
↓ 2 callers
Function
toZerologLevel
(level Level)
internal/observability/logger/logger.go:195
↓ 1 callers
Method
Clamp
Clamp enforces sane bounds: - Number < 1 → 1 - Size < 1 → 20 (default) - Size > maxSize (when maxSize > 0) → maxSize
internal/db/page.go:21
↓ 1 callers
Method
ComparePassword
(hashedPassword, password string)
internal/auth/password.go:28
↓ 1 callers
Function
ConsumerAuthRequired
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 callers
Method
Create
(ctx context.Context, params examplerepo.CreateParams)
internal/app/business/example/create.go:24
↓ 1 callers
Function
CreateTestDB
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 callers
Method
DebugW
(ctx context.Context, msg string, fields map[string]any)
internal/observability/logger/logger.go:20
↓ 1 callers
Method
Delete
(ctx context.Context, id uuid.UUID)
internal/app/business/example/delete.go:17
↓ 1 callers
Method
EncryptPassword
(password string)
internal/auth/password.go:20
↓ 1 callers
Method
ErrorCode
()
internal/httperrors/bad_request.go:27
↓ 1 callers
Function
FailSpan
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 callers
Function
GRPCAuthOptional
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 callers
Function
GRPCLogging
GRPCLogging returns a unary server interceptor that logs every inbound RPC call and any errors the handler returns.
internal/middleware/grpc.go:77
↓ 1 callers
Function
GRPCTracing
GRPCTracing returns a unary server interceptor that starts an OTel span for every call.
internal/middleware/grpc.go:96
↓ 1 callers
Function
GenerateToken
GenerateToken creates a signed JWT token for testing.
test/pkg/suite/option.go:96
↓ 1 callers
Method
GetByID
(ctx context.Context, id uuid.UUID)
internal/app/business/example/get.go:20
↓ 1 callers
Method
GetName
()
api/proto/grpc/v1/gen/example.pb.go:385
↓ 1 callers
Method
GetValue
()
internal/text/nonlogable.go:20
↓ 1 callers
Method
GoString
()
internal/text/nonlogable.go:18
↓ 1 callers
Method
Handle
(ctx context.Context, err error)
internal/gokit/http/http.go:66
↓ 1 callers
Function
InitializeClients
InitializeClients initialises all external client connections and returns them wrapped in a Dependencies struct.
internal/app/transport/http/bootstrap/client_initializer.go:10
↓ 1 callers
Function
InitializeRepositories
InitializeRepositories wires up and returns the shared repository instances.
internal/app/transport/http/bootstrap/repositories_initializer.go:9
↓ 1 callers
Function
InitializeRepositories
InitializeRepositories wires up and returns the shared repository instances.
internal/app/transport/grpc/bootstrap/repositories_initializer.go:9
↓ 1 callers
Function
InitializeRepositories
InitializeRepositories wires up and returns the shared repository instances.
internal/app/transport/consumer/bootstrap/repositories_initializer.go:9
↓ 1 callers
Function
InitializeRouter
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 callers
Function
InitializeRoutes
InitializeRoutes builds and returns the root mux.Router.
internal/app/transport/http/bootstrap/router_initializer.go:16
↓ 1 callers
Function
InitializeServiceHandler
InitializeServiceHandler wires up and returns the ExampleServiceHandler.
internal/app/transport/grpc/bootstrap/handler_initializer.go:78
↓ 1 callers
Method
List
(ctx context.Context)
internal/app/business/example/list.go:17
↓ 1 callers
Function
LoggingGRPCMiddleware
LoggingGRPCMiddleware logs gRPC endpoint processing with masking.
internal/middleware/logging.go:35
↓ 1 callers
Function
LoggingPubSubMiddleware
LoggingPubSubMiddleware logs pub/sub message processing with masking. Attaches topic and transport attributes to every log line.
internal/middleware/logging.go:16
↓ 1 callers
Function
NewBadRequestError
(message string)
internal/httperrors/bad_request.go:36
↓ 1 callers
Function
NewBadRequestErrorWithCode
(message, code string)
internal/httperrors/bad_request.go:40
↓ 1 callers
Function
NewConflictError
(message string)
internal/httperrors/conflict.go:26
↓ 1 callers
Function
NewConn
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 callers
Function
NewConsumerProcess
()
cmd/app/consumer.go:17
↓ 1 callers
Function
NewDeadlineError
()
internal/middleware/gokit.go:19
↓ 1 callers
Function
NewExampleServiceHandler
( createHandler grpctransport.Handler, getHandler grpctransport.Handler, listHandler grpctransport.Handler,
internal/app/transport/grpc/v1/example_handler.go:21
↓ 1 callers
Function
NewForbiddenError
(message string)
internal/httperrors/forbidden.go:26
↓ 1 callers
Function
NewGRPCServerProcess
()
cmd/app/grpc.go:17
↓ 1 callers
Function
NewHTTPServerProcess
()
cmd/app/http.go:17
↓ 1 callers
Function
NewLogErrorHandler
(lgr logger.Logger)
internal/gokit/http/http.go:62
↓ 1 callers
Function
NewLogErrorHandler
(lgr logger.Logger)
internal/gokit/grpc/grpc.go:36
↓ 1 callers
Function
NewPageResult
NewPageResult computes PageResult from a clamped Page and a total count.
internal/db/page.go:43
↓ 1 callers
Function
NewPasswordGenerator
()
internal/auth/password.go:16
↓ 1 callers
Function
NewReporter
NewReporter registers the service-level metric instruments on the provided meter.
internal/observability/metric/metric.go:23
↓ 1 callers
Function
NewSharedResource
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 callers
Function
NewSharedResource
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 callers
Function
NewUnauthorizedError
(message string)
internal/httperrors/unauthorized.go:26
↓ 1 callers
Method
Offset
Offset derives the SQL OFFSET value for this page.
internal/db/page.go:10
↓ 1 callers
Function
ParseDSN
ParseDSN parses a PostgreSQL DSN into a DBConfig.
test/pkg/testdb/testdb.go:45
↓ 1 callers
Method
RecordRequest
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 callers
Function
RegisterV1Routes
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 callers
Method
Run
(ctx context.Context)
internal/worker/consumer.go:44
↓ 1 callers
Method
Schedule
(args ProcessArgs)
cmd/app/job.go:6
↓ 1 callers
Function
StartSpan
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 callers
Method
Unwrap
()
internal/httperrors/processing.go:19
↓ 1 callers
Method
Warn
(ctx context.Context, msg string)
internal/observability/logger/logger.go:23
↓ 1 callers
Method
WarnW
(ctx context.Context, msg string, fields map[string]any)
internal/observability/logger/logger.go:24
↓ 1 callers
Method
WithCallerSkip
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 callers
Function
WithClaimsParserTTL
WithClaimsParserTTL overrides the default token TTL.
internal/auth/jwt.go:33
↓ 1 callers
Method
WithHost
WithHost returns a new logger with the host field set.
internal/observability/logger/logger.go:84
↓ 1 callers
Function
WithMeter
WithMeter enables runtime metrics collection on the HTTP server.
internal/app/transport/http/bootstrap/di_container.go:50
↓ 1 callers
Function
WithMeterProvider
WithMeterProvider sets the OTel MeterProvider on the HTTP server.
internal/app/transport/http/bootstrap/di_container.go:55
↓ 1 callers
Method
WithPrettyOutput
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 callers
Function
WithTracer
WithTracer enables distributed tracing on the HTTP server.
internal/app/transport/http/bootstrap/di_container.go:45
↓ 1 callers
Function
WithTracer
WithTracer enables distributed tracing on the gRPC server.
internal/app/transport/grpc/bootstrap/di_container.go:42
↓ 1 callers
Function
WithTracerProvider
WithTracerProvider enables OTel tracing on all SQL operations.
internal/clients/db/mysql/db.go:29
↓ 1 callers
Function
applyContextFields
(ctx context.Context, event *zerolog.Event)
internal/observability/logger/logger.go:185
↓ 1 callers
Function
applyMigrations
applyMigrations runs all up migrations against the given database.
test/pkg/testdb/testdb.go:163
↓ 1 callers
Function
buildConfig
(opts ...Option)
test/pkg/testdb/testdb.go:148
↓ 1 callers
Function
buildLogAttrs
buildLogAttrs marshals request and response with sensitive-field masking applied.
internal/middleware/logging.go:65
↓ 1 callers
Function
chooseAuthMiddleware
chooseAuthMiddleware selects the right JWT middleware based on config.
internal/app/transport/consumer/consumer.go:128
↓ 1 callers
Function
defaultParser
(t *testing.T)
internal/auth/jwt_test.go:18
↓ 1 callers
Function
domainErrorCode
(err error)
internal/app/transport/http/encoder/json_error_encoder.go:57
↓ 1 callers
Function
file_example_proto_init
()
api/proto/grpc/v1/gen/example.pb.go:516
↓ 1 callers
Function
findMigrationsDir
findMigrationsDir walks upward from the working directory looking for db/migrations (the project convention).
test/pkg/testdb/testdb.go:190
↓ 1 callers
Function
findProjectRoot
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 callers
Function
initializeCreateExampleHandler
( cfg config.Config, lgr logger.Logger, repos *SharedRepositories, )
internal/app/transport/http/bootstrap/handler_initializer.go:16
↓ 1 callers
Function
initializeCreateExampleHandler
( cfg config.Config, resources *SharedResource, repos *SharedRepositories, )
internal/app/transport/grpc/bootstrap/handler_initializer.go:13
↓ 1 callers
Function
initializeDeleteExampleHandler
( cfg config.Config, lgr logger.Logger, repos *SharedRepositories, )
internal/app/transport/http/bootstrap/handler_initializer.go:70
↓ 1 callers
Function
initializeDeleteExampleHandler
( cfg config.Config, resources *SharedResource, repos *SharedRepositories, )
internal/app/transport/grpc/bootstrap/handler_initializer.go:61
↓ 1 callers
Function
initializeGetExampleHandler
( cfg config.Config, lgr logger.Logger, repos *SharedRepositories, )
internal/app/transport/http/bootstrap/handler_initializer.go:34
↓ 1 callers
Function
initializeGetExampleHandler
( cfg config.Config, resources *SharedResource, repos *SharedRepositories, )
internal/app/transport/grpc/bootstrap/handler_initializer.go:29
↓ 1 callers
Function
initializeListExamplesHandler
( cfg config.Config, lgr logger.Logger, repos *SharedRepositories, )
internal/app/transport/http/bootstrap/handler_initializer.go:52
↓ 1 callers
Function
initializeListExamplesHandler
( cfg config.Config, resources *SharedResource, repos *SharedRepositories, )
internal/app/transport/grpc/bootstrap/handler_initializer.go:45
↓ 1 callers
Function
invokeMethod
(methodName, data, metadata)
test/load/pkg/grpc/client.js:30
↓ 1 callers
Function
isCanceledError
(ctx context.Context, err error)
internal/app/transport/http/encoder/json_error_encoder.go:74
↓ 1 callers
Function
jitterBackoff
(min, max time.Duration, attempt int)
internal/httpx/client.go:165
↓ 1 callers
Function
jitterBackoff
(min, max time.Duration, attempt int)
internal/grpcx/client.go:137
↓ 1 callers
Function
meter
(name string, opts ...otelmeter.MeterOption)
cmd/main.go:113
← previous
next →
101–200 of 465, ranked by callers