Errors Sentinel errors returned by Grove operations.
Grove defines sentinel errors for all failure cases. Use errors.Is() to check for specific errors.
Error Description ErrNoRowsQuery returned no rows (similar to sql.ErrNoRows) ErrModelNotRegisteredModel type was not registered via RegisterModel() ErrNotSupportedOperation not supported by the current driver
Error Description ErrDriverClosedDriver connection pool has been closed ErrTxDoneTransaction has already been committed or rolled back ErrInvalidDSNData source name is malformed
Error Description ErrMigrationFailedA migration function returned an error ErrMigrationLockedAnother process holds the migration lock ErrCyclicDependencyMigration group dependencies form a cycle ErrDuplicateVersionTwo migrations share the same version string
Error Description ErrHookDeniedA privacy hook returned Decision: Deny ErrHookPanicA hook panicked during execution (recovered)
Error Description ErrInvalidTagStruct tag has invalid syntax ErrNoPrimaryKeyModel has no field marked as pk ErrInvalidRelationRelation definition is incomplete or incorrect
import " github.com/xraph/grove "
var users [] User
err := db. NewSelect ( & users).
Where ( "active = $1" , true ).
Scan (ctx)
if errors. Is (err, grove.ErrNoRows) {
// No matching users found
}
if errors. Is (err, grove.ErrModelNotRegistered) {
// Forgot to call db.RegisterModel((*User)(nil))
}
All errors returned by Grove wrap the underlying driver error when available:
err := db. NewSelect ( & users). Scan (ctx)
if err != nil {
// Unwrap to get the original pgx/mysql error
var pgErr * pgconn . PgError
if errors. As (err, & pgErr) {
fmt. Println (pgErr.Code) // e.g., "23505" for unique violation
}
}