Documentation ¶
Overview ¶
Package dbassert provides a set of assertions for testing the boundary database applications.
Example Usage:
import ( "testing" "github.com/hashicorp/internal/db/assert" ) func TestSomeDatabase(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) if err != nil { t.Fatal(err) } m := TestModel{} if err = rw.Create(&m); err != nil { t.Fatal(err) } dbassert := dbassert.New(t, db) dbassert.FieldIsNull(&someModel, "someField") }
Index ¶
- type DbAsserts
- func (a *DbAsserts) Domain(resource interface{}, fieldName, domainName string) bool
- func (a *DbAsserts) IsNull(resource interface{}, fieldName string) bool
- func (a *DbAsserts) Log(enable bool)
- func (a *DbAsserts) NotNull(resource interface{}, fieldName string) bool
- func (a *DbAsserts) Nullable(resource interface{}, fieldName string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbAsserts ¶
type DbAsserts struct {
// contains filtered or unexported fields
}
DbAsserts provides database assertion methods.
Click to show internal directories.
Click to hide internal directories.