Merge pull request 'chore: migrate module path from gitlab.com to git.unbound.se' (#59) from migrate-to-gitea into main
dbsetup / test (push) Successful in 2m35s
dbsetup / vulnerabilities (push) Successful in 3m57s

Reviewed-on: #59
This commit was merged in pull request #59.
This commit is contained in:
2026-01-09 07:08:05 +00:00
5 changed files with 70 additions and 12 deletions
+15
View File
@@ -0,0 +1,15 @@
{
"permissions": {
"allow": [
"Bash(ls:*)",
"Bash(git -C /Users/argoyle/Source/Unbound/dbsetup log --oneline -20)",
"Bash(find:*)",
"WebSearch",
"Bash(git add:*)",
"Bash(pre-commit run:*)",
"Bash(go build:*)",
"Bash(go test:*)",
"Bash(but status)"
]
}
}
+1 -8
View File
@@ -10,13 +10,6 @@ repos:
args:
- --allow-multiple-documents
- id: check-added-large-files
- repo: https://gitlab.com/devopshq/gitlab-ci-linter
rev: v1.0.6
hooks:
- id: gitlab-ci-linter
args:
- --project
- unboundsoftware/dbsetup
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.23.0
hooks:
@@ -30,7 +23,7 @@ repos:
- id: go-imports
args:
- -local
- gitlab.com/unboundsoftware/shiny/presenter
- git.unbound.se/unboundsoftware/shiny/presenter
- repo: https://github.com/lietu/go-pre-commit
rev: v1.0.0
hooks:
+53
View File
@@ -0,0 +1,53 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
**dbsetup** is a Go helper module for database connection pool initialization with OpenTelemetry (OTEL) instrumentation. It wraps database connections with OTEL to automatically add SQL queries to tracing spans.
- Module path: `git.unbound.se/unboundsoftware/dbsetup`
- Primary dependencies: sqlx, goose (migrations), otelsqlx (OTEL wrapper)
## Common Commands
```bash
# Download dependencies
go mod download
# Run tests with race detection and coverage
CGO_ENABLED=1 go test -race -coverprofile=coverage.txt ./...
# Generate coverage report
go tool cover -html=coverage.txt -o coverage.html
# Check for security vulnerabilities
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
# Run pre-commit hooks (add all files first)
git add -A && pre-commit run --all-files
```
## Architecture
Single-package module with one source file (`database.go`):
- **DatabaseConfig**: Configuration struct with connection URL, driver name, and pool settings. Uses struct tags compatible with kong CLI parser.
- **Database**: Main handler providing:
- `SetupDB()` - Validates database connection and returns Database instance
- `Connect()` - Creates OTEL-wrapped connection pool via otelsqlx
- `RunMigrations()` - Executes goose migrations from an `fs.FS` filesystem
## Code Quality
Pre-commit hooks enforce:
- gofumpt formatting (stricter than gofmt)
- golangci-lint
- go-imports with local path `git.unbound.se/unboundsoftware/`
- Conventional commits format (feat:, fix:, chore:, etc.)
- Gitleaks for secret detection
## CI/CD
GitLab CI pipeline runs: dependency download → tests with race detector → vulnerability scanning → Codecov upload.
-3
View File
@@ -2,6 +2,3 @@
Helper module for setting up database connection pool using an
OTEL-wrapper which adds the actual query to a span.
[![Build Status](https://gitlab.com/unboundsoftware/dbsetup/badges/main/pipeline.svg)](https://gitlab.com/unboundsoftware/dbsetup/commits/main)
[![codecov](https://codecov.io/gl/unboundsoftware/dbsetup/branch/main/graph/badge.svg?token=XHA5XE1UVL)](https://codecov.io/gl/unboundsoftware/dbsetup)
+1 -1
View File
@@ -1,4 +1,4 @@
module gitlab.com/unboundsoftware/dbsetup
module git.unbound.se/unboundsoftware/dbsetup
go 1.24.4