Skip to content

Add support for SAP HANA. - #81

Merged
ggreer merged 4 commits into
mainfrom
ggreer/sap-hana
Oct 2, 2025
Merged

Add support for SAP HANA.#81
ggreer merged 4 commits into
mainfrom
ggreer/sap-hana

Conversation

@ggreer

@ggreer ggreer commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

Description

  • Bug fix
  • New feature

Useful links:


Note

Adds SAP HANA support via hdb driver and connection ping validation, with test docker config, example config, and dependency updates.

  • Database:
    • SAP HANA Support: Add hdb engine integration.
      • New pkg/database/hdb with Connect using SAP/go-hdb.
      • Extend database.Connect to handle hdb:// DSNs.
    • Validation: Connector.Validate now pings the DB (db.Ping()).
  • Examples & Testing:
    • Add docker-compose-hanaexpress-test.yml and examples/sap-hana-test.yml for local HANA testing.
  • Dependencies:
    • Vendor github.com/SAP/go-hdb and update golang.org/x/* versions.
  • Misc:
    • Include test password fixture test/hanaexpress/password.json.

Written by Cursor Bugbot for commit 78c0a61. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • New Features

    • Added SAP HANA (HDB) database support and a helper to open HDB connections.
  • Bug Fixes

    • Connection validation now performs a real connectivity check and surfaces errors.
  • Chores

    • Updated Go and database-related dependencies (including SAP/go-hdb and golang.org/x/*).
    • Removed explicit MySQL connection pool configuration; defaults are used.

@coderabbitai

coderabbitai Bot commented Oct 1, 2025

Copy link
Copy Markdown

Walkthrough

Adds SAP HANA support by introducing a new hdb package and routing scheme "hdb" in database Connect; updates module dependencies; connector validation now performs a real DB PingContext; removes explicit MySQL pool configuration.

Changes

Cohort / File(s) Summary
Module dependencies
go.mod
Add github.com/SAP/go-hdb@v1.14.5; bump golang.org/x/text to v0.29.0; bump indirect golang.org/x/sync to v0.17.0.
Database engine routing
pkg/database/database.go
Import internal hdb package; add HDB to DbEngine; extend Connect switch to support scheme hdb by calling hdb.Connect(ctx, dsn) and returning HDB, propagating errors.
HDB connector
pkg/database/hdb/hdb.go
New package providing Connect(ctx context.Context, dsn string) (*sql.DB, error) which calls sql.Open("hdb", dsn) (blank-imports the driver) and returns the DB or error. Context is accepted but not used; no explicit pool configuration added.
Connector validation
pkg/connector/connector.go
Replace placeholder validation with a real connectivity check using c.db.PingContext(ctx); propagate Ping errors or return success.
MySQL connector cleanup
pkg/database/mysql/mysql.go
Removed time import and constants MaxIdleConns, MaxOpenConns, MaxConnLifetime; removed calls to db.SetMaxOpenConns, db.SetMaxIdleConns, and db.SetConnMaxLifetime (defaults now used).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant DB as pkg/database.Connect
  participant HDB as pkg/database/hdb.Connect
  participant SQL as database/sql.Open
  Caller->>DB: Connect(ctx, dsn "hdb://...")
  DB->>DB: parse scheme == "hdb"
  DB->>HDB: Connect(ctx, dsn)
  HDB->>SQL: sql.Open("hdb", dsn)
  SQL-->>HDB: (*sql.DB or error)
  HDB-->>DB: (*sql.DB, nil) or (nil, err)
  alt success
    DB-->>Caller: (*sql.DB, HDB, nil)
  else error
    DB-->>Caller: (nil, HDB, err)
  end
Loading
sequenceDiagram
  autonumber
  actor Service
  participant Connector as pkg/connector.Validate
  participant DB as *sql.DB

  Service->>Connector: Validate(ctx)
  Connector->>DB: db.PingContext(ctx)
  alt ping ok
    DB-->>Connector: nil
    Connector-->>Service: nil
  else ping fail
    DB-->>Connector: error
    Connector-->>Service: error
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I thump my paws—new tunnels spun,
A HDB burrow, neatly done.
Pings echo clear, connections greet,
Old pools retired, defaults take seat.
Hop in—data gardens run. 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title succinctly and accurately describes the primary change of adding SAP HANA support, making it clear and specific without extraneous details.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ggreer/sap-hana

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
pkg/database/hdb/hdb.go (1)

17-27: Use the context to validate the HANA connection

Connect ignores ctx and will happily return a pool even if the DSN is wrong or the host is unavailable. Ping with the supplied context (and close on failure) so we fail fast and respect cancellation.

 func Connect(ctx context.Context, dsn string) (*sql.DB, error) {
 	db, err := sql.Open("hdb", dsn)
 	if err != nil {
 		return nil, err
 	}
 
 	db.SetMaxOpenConns(MaxOpenConns)
 	db.SetMaxIdleConns(MaxIdleConns)
 	db.SetConnMaxLifetime(MaxConnLifetime)
+
+	if err := db.PingContext(ctx); err != nil {
+		_ = db.Close()
+		return nil, err
+	}
 
 	return db, nil
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 782ffbf and 18bdfe3.

⛔ Files ignored due to path filters (86)
  • go.sum is excluded by !**/*.sum and included by none
  • vendor/github.com/SAP/go-hdb/LICENSE.md is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/bytes.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/calldriver.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/conn.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/connector.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/convert.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/dbconn.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/dbconnectinfo.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/decimal.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/deprecated.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/dial/dialer.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/doc.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/driver.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/dsn.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/error.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/identifier.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth/auth.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth/certkey.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth/jwt.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth/list.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth/scram.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth/scrampbkdf2sha256.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth/scramsha256.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth/sessioncookie.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/auth/x509.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/convert.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/datatype.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/decode.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/decodeerror.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/dfv.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/doc.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/encoding/datetime.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/encoding/decimal.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/encoding/decode.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/encoding/doc.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/encoding/encode.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/encoding/field.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/error.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/fieldnames.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/functioncode.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/headers.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/init.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/julian/julian.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/keyvaluesparts.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/levenshtein/levenshtein.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/lob.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/messagetype.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/optionsparts.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/optiontype.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/parameter.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/partkind.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/parts.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/parts1.24.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/parts1.25.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/protocol.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/resizeslice.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/result.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/rowsaffected.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/simpleparts.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/typecode.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/x_generator.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/protocol/x_stringer.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/rand/alphanum/rand.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/internal/unsafe/unsafe.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/lob.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/metadata.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/metrics.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/result.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/scanner.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/session.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/sniffer.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/stats.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/stats.tmpl is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/statscfg.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/statscfg.json is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/stmt.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/trace.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/unicode/cesu8/cesu8.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/unicode/cesu8/encoding.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/version.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/wgroup/wgroup1.24.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/wgroup/wgroup1.25.go is excluded by !vendor/** and included by none
  • vendor/github.com/SAP/go-hdb/driver/x_bstring_test.py is excluded by !vendor/** and included by none
  • vendor/modules.txt is excluded by !vendor/** and included by none
📒 Files selected for processing (3)
  • go.mod (3 hunks)
  • pkg/database/database.go (3 hunks)
  • pkg/database/hdb/hdb.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Error handling: use fmt.Errorf with contextual messages; check specific errors with errors.Is
Organize imports: standard library first, then third-party, then project imports; alphabetize within each group
Naming: CamelCase for exported identifiers; camelCase for unexported; preserve acronyms like ID, URL, HTTP, API
Limit line length to a maximum of 200 characters
Comments for exported items must be complete sentences ending with periods
Do not use log.Fatal or log.Panic (ruleguard-enforced)

Files:

  • pkg/database/hdb/hdb.go
  • pkg/database/database.go
🧬 Code graph analysis (2)
pkg/database/hdb/hdb.go (1)
pkg/database/database.go (1)
  • Connect (53-121)
pkg/database/database.go (1)
pkg/database/hdb/hdb.go (1)
  • Connect (17-28)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: test
  • GitHub Check: go-lint
  • GitHub Check: go-test (ubuntu-latest)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 18bdfe3 and d9827f9.

⛔ Files ignored due to path filters (3)
  • docker-compose-hanaexpress-test.yml is excluded by none and included by none
  • examples/sap-hana-test.yml is excluded by none and included by none
  • test/hanaexpress/password.json is excluded by none and included by none
📒 Files selected for processing (1)
  • pkg/connector/connector.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Error handling: use fmt.Errorf with contextual messages; check specific errors with errors.Is
Organize imports: standard library first, then third-party, then project imports; alphabetize within each group
Naming: CamelCase for exported identifiers; camelCase for unexported; preserve acronyms like ID, URL, HTTP, API
Limit line length to a maximum of 200 characters
Comments for exported items must be complete sentences ending with periods
Do not use log.Fatal or log.Panic (ruleguard-enforced)

Files:

  • pkg/connector/connector.go
🪛 GitHub Actions: ci
pkg/connector/connector.go

[error] 79-79: golangci-lint: (*database/sql.DB).Ping must not be called. use (*database/sql.DB).PingContext (noctx) at connector.go:79

🪛 GitHub Check: go-lint
pkg/connector/connector.go

[failure] 79-79:
(*database/sql.DB).Ping must not be called. use (*database/sql.DB).PingContext (noctx)

Comment thread pkg/connector/connector.go Outdated
Comment on lines +79 to +82
err := c.db.Ping()
if err != nil {
return nil, err
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Use PingContext instead of Ping and add error context.

The linter correctly flags that Ping() must not be called. Use PingContext(ctx) to properly propagate the context parameter. Additionally, per the coding guidelines, wrap the error with fmt.Errorf to provide contextual information.

Apply this diff:

-	err := c.db.Ping()
+	err := c.db.PingContext(ctx)
 	if err != nil {
-		return nil, err
+		return nil, fmt.Errorf("failed to ping database: %w", err)
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
err := c.db.Ping()
if err != nil {
return nil, err
}
err := c.db.PingContext(ctx)
if err != nil {
return nil, fmt.Errorf("failed to ping database: %w", err)
}
🧰 Tools
🪛 GitHub Actions: ci

[error] 79-79: golangci-lint: (*database/sql.DB).Ping must not be called. use (*database/sql.DB).PingContext (noctx) at connector.go:79

🪛 GitHub Check: go-lint

[failure] 79-79:
(*database/sql.DB).Ping must not be called. use (*database/sql.DB).PingContext (noctx)

🤖 Prompt for AI Agents
In pkg/connector/connector.go around lines 79 to 82, replace the blocking
c.db.Ping() call with c.db.PingContext(ctx) so the operation respects
cancellation/timeout, and wrap any returned error with fmt.Errorf to add context
(e.g. "pinging database: %w"); also ensure the function has access to a ctx
variable and add/import "fmt" if not already present.

Comment thread pkg/connector/connector.go
Comment thread pkg/database/hdb/hdb.go Outdated
const (
MaxIdleConns = 10
MaxOpenConns = 10
MaxConnLifetime = 5 * time.Minute

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im sligtly confused by these constants being here. i understand other packages might do this, but asking as we had more drivers.... seems like a wrong pattern hash-tag-bridge-too-far

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b1f9a0 and 09a5e68.

📒 Files selected for processing (2)
  • pkg/database/hdb/hdb.go (1 hunks)
  • pkg/database/mysql/mysql.go (0 hunks)
💤 Files with no reviewable changes (1)
  • pkg/database/mysql/mysql.go
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Error handling: use fmt.Errorf with contextual messages; check specific errors with errors.Is
Organize imports: standard library first, then third-party, then project imports; alphabetize within each group
Naming: CamelCase for exported identifiers; camelCase for unexported; preserve acronyms like ID, URL, HTTP, API
Limit line length to a maximum of 200 characters
Comments for exported items must be complete sentences ending with periods
Do not use log.Fatal or log.Panic (ruleguard-enforced)

Files:

  • pkg/database/hdb/hdb.go
🧬 Code graph analysis (1)
pkg/database/hdb/hdb.go (2)
pkg/database/mysql/mysql.go (1)
  • Connect (47-59)
pkg/database/database.go (1)
  • Connect (53-121)
🔇 Additional comments (2)
pkg/database/hdb/hdb.go (2)

1-8: LGTM! Import organization follows guidelines.

The package declaration and imports are correctly organized with standard library imports first, followed by third-party imports. The blank import for the HDB driver registration is the standard pattern for database/sql drivers.


10-10: Context parameter is unused but consistent with other database packages.

The ctx parameter is declared but not used within the function body. While sql.Open does not accept a context, this signature is consistent with other database package Connect functions in the codebase (e.g., mysql.Connect, oracle.Connect). This appears to be an intentional design choice for API consistency and potential future use.

If context usage is planned for future enhancements (e.g., connection timeouts, cancellation during driver initialization), consider documenting this intent in the function comment.

Comment thread pkg/database/hdb/hdb.go
Comment on lines +10 to +17
func Connect(ctx context.Context, dsn string) (*sql.DB, error) {
db, err := sql.Open("hdb", dsn)
if err != nil {
return nil, err
}

return db, nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add documentation for the exported function.

The exported Connect function is missing a documentation comment. Per coding guidelines, all exported items must have complete sentence comments ending with periods.

Apply this diff to add documentation:

+// Connect establishes a connection to a SAP HANA database using the provided DSN.
+// It returns a configured sql.DB instance or an error if the connection cannot be opened.
 func Connect(ctx context.Context, dsn string) (*sql.DB, error) {
 	db, err := sql.Open("hdb", dsn)
 	if err != nil {
 		return nil, err
 	}
 
 	return db, nil
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func Connect(ctx context.Context, dsn string) (*sql.DB, error) {
db, err := sql.Open("hdb", dsn)
if err != nil {
return nil, err
}
return db, nil
}
// Connect establishes a connection to a SAP HANA database using the provided DSN.
// It returns a configured sql.DB instance or an error if the connection cannot be opened.
func Connect(ctx context.Context, dsn string) (*sql.DB, error) {
db, err := sql.Open("hdb", dsn)
if err != nil {
return nil, err
}
return db, nil
}
🤖 Prompt for AI Agents
In pkg/database/hdb/hdb.go around lines 10 to 17, the exported Connect function
lacks a documentation comment; add a complete sentence comment immediately above
the function that describes what Connect does, mentions the ctx and dsn
parameters (context for cancellation/timeout and Data Source Name), and
summarizes the return values (a *sql.DB on success or an error on failure), and
ensure the sentence ends with a period.

@ggreer
ggreer merged commit 4f811b1 into main Oct 2, 2025
4 checks passed
@ggreer
ggreer deleted the ggreer/sap-hana branch October 2, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants