Documentation
¶
Index ¶
- func BuildPostgresDSN(c *models.DriverCredentials) (string, error)
- func ErrCredentialsRequired() error
- func ExecAlterIgnoreDuplicate(ctx context.Context, db *bun.DB, sql string) error
- func IsDuplicateColumnError(err error) bool
- func IsSQLUniqueViolation(err error) bool
- func NormalizeEngine(engine string) string
- func OpenMariaDB(cred *models.DriverCredentials) (*bun.DB, error)
- func OpenMySQL(cred *models.DriverCredentials) (*bun.DB, error)
- func OpenPostgres(cred *models.DriverCredentials) (*bun.DB, error)
- func OpenSQLite(cfg *models.Config, cred *models.DriverCredentials) (*bun.DB, error)
- func RegisterSystemSQLSchemaModels(orm *bun.DB)
- func SupportedEngine(engine string) bool
- func SystemSQLSchemaModels() []interface{}
- type Base
- type Driver
- type OrganizationProjectRow
- type ProjectTeamRow
- type RawDataRow
- type TeamMetadataRow
- type TokenBlacklistRow
- type UserMetadataRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPostgresDSN ¶
func BuildPostgresDSN(c *models.DriverCredentials) (string, error)
BuildPostgresDSN builds a libpq URL for pgdriver from credentials.
func ErrCredentialsRequired ¶
func ErrCredentialsRequired() error
ErrCredentialsRequired is returned when driver credentials are missing.
func ExecAlterIgnoreDuplicate ¶
ExecAlterIgnoreDuplicate runs ALTER DDL and ignores duplicate-column errors.
func IsDuplicateColumnError ¶
IsDuplicateColumnError reports duplicate column DDL errors.
func IsSQLUniqueViolation ¶
IsSQLUniqueViolation reports primary/unique constraint violations across SQL engines.
func NormalizeEngine ¶
NormalizeEngine returns the canonical engine constant.
func OpenMariaDB ¶
func OpenMariaDB(cred *models.DriverCredentials) (*bun.DB, error)
OpenMariaDB opens a MariaDB system database (same driver as MySQL).
func OpenMySQL ¶
func OpenMySQL(cred *models.DriverCredentials) (*bun.DB, error)
OpenMySQL opens a MySQL system database.
func OpenPostgres ¶
func OpenPostgres(cred *models.DriverCredentials) (*bun.DB, error)
OpenPostgres opens a PostgreSQL system database.
func OpenSQLite ¶
OpenSQLite opens a local SQLite system database.
func RegisterSystemSQLSchemaModels ¶
RegisterSystemSQLSchemaModels registers m2m join types (user_projects, etc.) on this *bun.DB. Required for any query touching models with bun m2m tags — not only during RunMigration. Call once per opened system DB connection (idempotent).
func SupportedEngine ¶
SupportedEngine reports whether the engine string is a supported open-core system SQL engine.
func SystemSQLSchemaModels ¶
func SystemSQLSchemaModels() []interface{}
SystemSQLSchemaModels returns the full ordered list of tables for RunMigration.
Types ¶
type OrganizationProjectRow ¶
type OrganizationProjectRow struct {
bun.BaseModel `bun:"table:organization_projects"`
OrganizationID string `bun:"organization_id,type:uuid,pk"`
ProjectID string `bun:"project_id,type:uuid,pk"`
AssignedBy string `bun:"assigned_by,type:uuid,nullzero"`
AssignedAt string `bun:"assigned_at,type:timestamp,nullzero"`
}