Add generated Bob database integration

This commit is contained in:
Eli Ribble 2025-11-04 23:11:32 +00:00
parent 8203c50b08
commit 7c4a181cdf
No known key found for this signature in database
32 changed files with 5128 additions and 2 deletions

View file

@ -0,0 +1,32 @@
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package dberrors
import "github.com/lib/pq"
// ErrUniqueConstraint captures all unique constraint errors by explicitly leaving `s` empty.
var ErrUniqueConstraint = &UniqueConstraintError{s: ""}
type UniqueConstraintError struct {
// schema is the schema where the unique constraint is defined.
schema string
// table is the name of the table where the unique constraint is defined.
table string
// columns are the columns constituting the unique constraint.
columns []string
// s is a string uniquely identifying the constraint in the raw error message returned from the database.
s string
}
func (e *UniqueConstraintError) Error() string {
return e.s
}
func (e *UniqueConstraintError) Is(target error) bool {
err, ok := target.(*pq.Error)
if !ok {
return false
}
return err.Code == "23505" && (e.s == "" || err.Constraint == e.s)
}

View file

@ -0,0 +1,9 @@
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package dberrors
import "github.com/stephenafamo/bob"
// Set the testDB to enable tests that use the database
var testDB bob.Transactor[bob.Tx]

View file

@ -0,0 +1,17 @@
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package dberrors
var GooseDBVersionErrors = &gooseDBVersionErrors{
ErrUniqueGooseDbVersionPkey: &UniqueConstraintError{
schema: "",
table: "goose_db_version",
columns: []string{"id"},
s: "goose_db_version_pkey",
},
}
type gooseDBVersionErrors struct {
ErrUniqueGooseDbVersionPkey *UniqueConstraintError
}

View file

@ -0,0 +1,17 @@
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package dberrors
var OrganizationErrors = &organizationErrors{
ErrUniqueOrganizationPkey: &UniqueConstraintError{
schema: "",
table: "organization",
columns: []string{"id"},
s: "organization_pkey",
},
}
type organizationErrors struct {
ErrUniqueOrganizationPkey *UniqueConstraintError
}

17
dberrors/user_.bob.go Normal file
View file

@ -0,0 +1,17 @@
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package dberrors
var UserErrors = &userErrors{
ErrUniqueUser_Pkey: &UniqueConstraintError{
schema: "",
table: "user_",
columns: []string{"id"},
s: "user__pkey",
},
}
type userErrors struct {
ErrUniqueUser_Pkey *UniqueConstraintError
}