No description
Find a file
dependabot[bot] 05b69e9db8
[chore] : Bump github.com/hashicorp/vault/sdk from 0.23.0 to 0.25.0 (#92)
Bumps [github.com/hashicorp/vault/sdk](https://github.com/hashicorp/vault) from 0.23.0 to 0.25.0.
- [Release notes](https://github.com/hashicorp/vault/releases)
- [Changelog](https://github.com/hashicorp/vault/blob/main/CHANGELOG-v1.10-v1.15.md)
- [Commits](https://github.com/hashicorp/vault/compare/sdk/v0.23.0...sdk/v0.25.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/vault/sdk
  dependency-version: 0.25.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-26 23:46:57 +05:30
.github [chore] : Bump github/codeql-action from 4.33.0 to 4.34.1 (#93) 2026-03-26 23:39:59 +05:30
gorm [COMPLIANCE] Update Copyright and License Headers (#54) 2025-11-03 18:02:11 +05:30
assert.go [COMPLIANCE] Update Copyright and License Headers (#54) 2025-11-03 18:02:11 +05:30
assert_test.go [COMPLIANCE] Update Copyright and License Headers (#54) 2025-11-03 18:02:11 +05:30
CHANGELOG.md Add changelog file for standardisation. (#16) 2025-06-02 17:00:53 +05:30
column.go [COMPLIANCE] Update Copyright and License Headers (#54) 2025-11-03 18:02:11 +05:30
column_test.go [COMPLIANCE] Update Copyright and License Headers (#54) 2025-11-03 18:02:11 +05:30
doc.go [COMPLIANCE] Update Copyright and License Headers (#54) 2025-11-03 18:02:11 +05:30
docker.go [chore] : Bump github/codeql-action from 4.30.9 to 4.31.3 (#59) 2025-11-20 15:55:13 +05:30
go.mod [chore] : Bump github.com/hashicorp/vault/sdk from 0.23.0 to 0.25.0 (#92) 2026-03-26 23:46:57 +05:30
go.sum [chore] : Bump github.com/hashicorp/vault/sdk from 0.23.0 to 0.25.0 (#92) 2026-03-26 23:46:57 +05:30
LICENSE [COMPLIANCE] Update Copyright and License Headers (#54) 2025-11-03 18:02:11 +05:30
README.md remove prefixes from function names 2020-06-01 14:02:14 -04:00
testing.go [COMPLIANCE] Update Copyright and License Headers (#54) 2025-11-03 18:02:11 +05:30
testing_test.go [COMPLIANCE] Update Copyright and License Headers (#54) 2025-11-03 18:02:11 +05:30

dbassert

The dbassert package provides some helpful functions to help you write better tests when writing Go database applications. The package supports both sql.DB and Gorm assertions.

Example sql.DB asserts usage:

package your_brilliant_pkg

import (
    "testing"
    dbassert "github.com/hashicorp/dbassert"
)

func TestSomeDb(t *testing.T) {
	conn, err := sql.Open("postgres", "postgres://postgres:secret@localhost:%s?sslmode=disable")
	if err != nil {
		t.Fatal(err)
	}
	defer conn.Close()
	
	dbassert := dbassert.New(t, conn, "postgres")
    
	// assert that the db column is nullable
	dbassert.Nullable("some_table", "some_column")

	// assert that the db column is a particular domain type
	dbassert.Domain("test_table_dbasserts", "public_id", "dbasserts_public_id")

}

Example Gorm asserts usage:

package your_brilliant_pkg

import (
    "testing"
    dbassert "github.com/hashicorp/dbassert/gorm"
)

func TestSomeGormModel(t *testing.T) {
	conn, err := sql.Open("postgres", "postgres://postgres:secret@localhost:%s?sslmode=disable")
	if err != nil {
		t.Fatal(err)
	}
	defer conn.Close()
	db, err := gorm.Open("postgres", conn)
 	m := testModel{}
	if err = db.Create(&m).Error; err != nil {
    	t.Fatal(err)
	}
	dbassert := dbassert.New(t, conn, "postgres")
    
	// assert that the db field is null
	dbassert.IsNull(&someModel, "SomeField")

	// assert that the db field is not null
	dbassert.NotNull(&someModel, "SomeField")

	// assert that the db field nullable
	dbassert.Nullable(&someModel, "SomeField")

	// assert that the db field is a particular domain type
	dbassert.Domain(&someModel, "SomeField", "some_domain_type")
}