MCPcopy Create free account

hub / github.com/LAA-Software-Engineering/golang-rest-api-template / functions

Functions337 in github.com/LAA-Software-Engineering/golang-rest-api-template

↓ 1 callersFunctionRequestContextTimeoutFromEnv
RequestContextTimeoutFromEnv is like RequestContextTimeout with a duration from REQUEST_CONTEXT_TIMEOUT (Go duration syntax). Empty uses 60s. "0", "of
pkg/middleware/request_timeout.go:35
↓ 1 callersFunctionSecurity
()
pkg/middleware/security.go:8
↓ 1 callersFunctionSetupMongoDB
SetupMongoDB connects to MongoDB and returns the application logs collection. It reads MONGODB_URI (e.g. mongodb://mongo:27017 under Docker Compose);
pkg/database/mongo.go:24
↓ 1 callersMethodUpdateFields
(id uint, title, author string)
pkg/repository/book.go:12
↓ 1 callersFunctionXss
()
pkg/middleware/xss.go:8
↓ 1 callersFunctionbcryptCostForPasswordHashing
bcryptCostForPasswordHashing returns the bcrypt cost for HashPassword. BCRYPT_COST overrides the default (12); it must parse as an integer in [minBcry
pkg/auth/auth.go:112
↓ 1 callersMethodcacheGeneration
(ctx context.Context)
pkg/service/book_service.go:46
↓ 1 callersFunctionconstantTimeAPIKeyEqual
constantTimeAPIKeyEqual reports whether provided equals secret using crypto/subtle. Length is folded into the compared buffers so a single ConstantTim
pkg/middleware/api_key.go:66
↓ 1 callersFunctiondelete_book
(book_id, jwt_token)
tests/e2e.py:102
↓ 1 callersMethodenqueue
(doc bson.M)
pkg/middleware/logger.go:54
↓ 1 callersFunctionget_books
(jwt_token)
tests/e2e.py:60
↓ 1 callersFunctionget_jwt_token
()
tests/e2e.py:24
↓ 1 callersFunctionignorableZapSyncErr
@title golang-rest-api-template @version 1.0 @description Go/Gin REST API template: books CRUD, register/login, Redis-backed lis
cmd/server/main.go:48
↓ 1 callersFunctionmaxRequestBodyBytesFromEnv
maxRequestBodyBytesFromEnv returns REQUEST_MAX_BODY_BYTES or the middleware default (1 MiB). Invalid or non-positive values panic at process startup.
pkg/api/router.go:89
↓ 1 callersFunctionnewMongoAccessLogQueue
(collection *mongo.Collection, logger *zap.Logger)
pkg/middleware/logger.go:30
↓ 1 callersFunctionnewRequestID
()
pkg/middleware/request_id.go:18
↓ 1 callersFunctionparseOffsetLimit
(c *gin.Context)
pkg/api/books.go:59
↓ 1 callersFunctionpatch_book
(book_id, jwt_token, payload: dict)
tests/e2e.py:91
↓ 1 callersFunctionreadyzHandler
(db *gorm.DB, redisClient cache.Cache, mongoCol *mongo.Collection)
pkg/api/probes.go:31
↓ 1 callersFunctionregisterProbeRoutes
registerProbeRoutes mounts Kubernetes-style liveness and readiness endpoints. They are registered before request logging, rate limiting, and the /api/
pkg/api/probes.go:22
↓ 1 callersFunctionsetupSQLiteDB
(t *testing.T)
pkg/database/db_test.go:14
↓ 1 callersFunctionupdate_book
(book_id, jwt_token)
tests/e2e.py:80
↓ 1 callersMethodworker
()
pkg/middleware/logger.go:43
MethodCreate
(user *models.User)
pkg/service/user_service_test.go:31
MethodCreate
(book *models.Book)
pkg/service/book_service_test.go:36
MethodCreate
(user *models.User)
pkg/repository/user.go:8
MethodCreate
Create mocks base method.
pkg/repository/mock_persistence.go:44
MethodCreate
Create indicates an expected call of Create.
pkg/repository/mock_persistence.go:52
MethodCreate
Create mocks base method.
pkg/repository/mock_persistence.go:156
MethodCreate
Create indicates an expected call of Create.
pkg/repository/mock_persistence.go:164
MethodCreateBook
CreateBook godoc @Summary Create a new book @Description Create a new book with the given input data @Tags books @Security ApiKeyAuth @Security JwtAut
pkg/api/books.go:165
MethodDel
(context.Context, ...string)
pkg/cache/cache.go:25
MethodDel
Del mocks base method.
pkg/cache/cache_mock.go:46
MethodDel
Del indicates an expected call of Del.
pkg/cache/cache_mock.go:58
MethodDeleteBook
DeleteBook godoc @Summary Delete a book by ID @Description Delete the book with the given ID @Tags books @Security ApiKeyAuth @Security JwtAuth @Produ
pkg/api/books.go:325
MethodDeleteByID
(id uint)
pkg/service/book_service_test.go:64
MethodDeleteByID
DeleteByID mocks base method.
pkg/repository/mock_persistence.go:58
MethodDeleteByID
DeleteByID indicates an expected call of DeleteByID.
pkg/repository/mock_persistence.go:66
MethodFindBook
(c *gin.Context)
pkg/api/books.go:31
MethodFindBook
FindBook godoc @Summary Find a book by ID @Description Get details of a book by its ID @Tags books @Security ApiKeyAuth @Produce json @Param id path s
pkg/api/books.go:194
MethodFindBooks
(c *gin.Context)
pkg/api/books.go:29
MethodFindBooks
FindBooks godoc @Summary Get all books with pagination @Description Get a list of all books with optional pagination. List entries are keyed by a mono
pkg/api/books.go:127
MethodFindByUsername
(username string)
pkg/service/user_service_test.go:24
MethodFindByUsername
FindByUsername mocks base method.
pkg/repository/mock_persistence.go:170
MethodFindByUsername
FindByUsername indicates an expected call of FindByUsername.
pkg/repository/mock_persistence.go:179
MethodFirstByID
(id uint)
pkg/service/book_service_test.go:43
MethodFirstByID
FirstByID mocks base method.
pkg/repository/mock_persistence.go:72
MethodFirstByID
FirstByID indicates an expected call of FirstByID.
pkg/repository/mock_persistence.go:81
MethodGet
Get indicates an expected call of Get.
pkg/cache/cache_mock.go:73
MethodHealthcheck
@BasePath /api/v1 Healthcheck godoc @Summary ping example @Schemes @Description do ping @Tags example @Accept json @Produce json @Success 200 {object}
pkg/api/books.go:111
MethodIncr
Incr mocks base method.
pkg/cache/cache_mock.go:79
MethodIncr
Incr indicates an expected call of Incr.
pkg/cache/cache_mock.go:87
MethodList
(offset, limit int)
pkg/service/book_service_test.go:29
MethodList
List mocks base method.
pkg/repository/mock_persistence.go:87
MethodList
List indicates an expected call of List.
pkg/repository/mock_persistence.go:96
MethodLoginHandler
(c *gin.Context)
pkg/api/user.go:18
MethodLoginHandler
@BasePath /api/v1 LoginHandler godoc @Summary Authenticate a user @Schemes @Description Authenticates a user using username and password, returns a JW
pkg/api/user.go:47
MethodPatchBook
PatchBook godoc @Summary Partially update a book by ID (PATCH) @Description Updates only fields present in the JSON body (at least one of title or aut
pkg/api/books.go:276
MethodPatchFields
(id uint, title, author *string)
pkg/service/book_service_test.go:57
MethodPatchFields
PatchFields mocks base method.
pkg/repository/mock_persistence.go:102
MethodPatchFields
PatchFields indicates an expected call of PatchFields.
pkg/repository/mock_persistence.go:111
MethodRegisterHandler
(c *gin.Context)
pkg/api/user.go:19
MethodRegisterHandler
RegisterHandler godoc @Summary Register a new user @Schemes http @Description Registers a new user with the given username and password @Tags user @Se
pkg/api/user.go:82
MethodSet
Set mocks base method.
pkg/cache/cache_mock.go:93
MethodSet
Set indicates an expected call of Set.
pkg/cache/cache_mock.go:101
FunctionTestAPIKeyAuthConcurrentValidRequests
(t *testing.T)
pkg/middleware/api_key_test.go:86
FunctionTestAPIKeyAuthMissingHeader
(t *testing.T)
pkg/middleware/api_key_test.go:64
FunctionTestAPIKeyAuthSecretNotConfiguredReturns503
(t *testing.T)
pkg/middleware/api_key_test.go:72
FunctionTestAPIKeyAuthValidKey
(t *testing.T)
pkg/middleware/api_key_test.go:34
FunctionTestAPIKeyAuthWrongKey
(t *testing.T)
pkg/middleware/api_key_test.go:43
FunctionTestAPIKeyAuthWrongLengthRejected
(t *testing.T)
pkg/middleware/api_key_test.go:55
FunctionTestAbort
(t *testing.T)
pkg/httperr/httperr_test.go:24
FunctionTestBookWriteRoutesConcurrentAuthorizedRequests
(t *testing.T)
pkg/api/book_routes_auth_test.go:189
FunctionTestBookWriteRoutesRejectTamperedJWT
(t *testing.T)
pkg/api/book_routes_auth_test.go:155
FunctionTestBookWriteRoutesRequireAPIKeyAndJWT
(t *testing.T)
pkg/api/book_routes_auth_test.go:37
FunctionTestBooksListDataCacheKey
(t *testing.T)
pkg/service/book_service_test.go:71
FunctionTestConfigureConnPoolSQLite
(t *testing.T)
pkg/database/db_test.go:24
FunctionTestConfigureTrustedProxiesAllowsForwardedFromTrustedPeer
(t *testing.T)
pkg/api/router_trusted_proxies_test.go:39
FunctionTestConfigureTrustedProxiesInvalidEnvReturnsError
(t *testing.T)
pkg/api/router_trusted_proxies_test.go:31
FunctionTestConfigureTrustedProxiesNilIgnoresForwardedFor
(t *testing.T)
pkg/api/router_trusted_proxies_test.go:12
FunctionTestCreateBook
(t *testing.T)
pkg/api/books_test.go:692
FunctionTestCreateBookBindError
(t *testing.T)
pkg/api/books_test.go:241
FunctionTestCreateBookBumpsGenerationWhenRedis
(t *testing.T)
pkg/service/book_service_test.go:247
FunctionTestCreateBookCacheIncrError
(t *testing.T)
pkg/api/books_test.go:281
FunctionTestCreateBookDatabaseError
(t *testing.T)
pkg/api/books_test.go:208
FunctionTestCreateBookNoIncrWhenNilRedis
(t *testing.T)
pkg/service/book_service_test.go:267
FunctionTestCreateBookRequiresAuthContext
(t *testing.T)
pkg/api/books_test.go:263
FunctionTestCreatedStructEnvelope
(t *testing.T)
pkg/httpresp/httpresp_test.go:26
FunctionTestDeleteBook
(t *testing.T)
pkg/api/books_test.go:810
FunctionTestDeleteBookBumpsGeneration
(t *testing.T)
pkg/service/book_service_test.go:342
FunctionTestDeleteBookBumpsListCacheGen
(t *testing.T)
pkg/api/books_test.go:585
FunctionTestDeleteBookDatabaseErrorOnDelete
(t *testing.T)
pkg/api/books_test.go:834
FunctionTestDeleteBookInvalidID
(t *testing.T)
pkg/api/books_test.go:615
FunctionTestDeleteBookNotFound
(t *testing.T)
pkg/api/books_test.go:634
FunctionTestDeleteBookWrongOwner
(t *testing.T)
pkg/service/book_service_test.go:384
FunctionTestErrUserUsernameConflictIsDistinct
(t *testing.T)
pkg/repository/repository_test.go:25
FunctionTestFindBook
(t *testing.T)
pkg/api/books_test.go:732
FunctionTestFindBookNotFound
(t *testing.T)
pkg/api/books_test.go:770
FunctionTestFindBookRejectsInvalidID
(t *testing.T)
pkg/api/books_test.go:791
FunctionTestFindBooks
(t *testing.T)
pkg/api/books_test.go:655
← previousnext →101–200 of 337, ranked by callers