postgresql

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBCreatorPostgresOrder = iota
)

Variables

View Source
var Module = &bootstrap.Module{
	Name:       "postgres-compatible",
	Precedence: bootstrap.DatabasePrecedence,
	Options: []fx.Option{
		fx.Provide(NewGormDialetor,
			pqErrorTranslatorProvider(),
			newAnnotatedGormDbCreator(),
		),
	},
}

Functions

func NewGormDbCreator

func NewGormDbCreator() data.DbCreator

func NewGormDialetor

func NewGormDialetor(di initDI) gorm.Dialector

func NewPqErrorTranslator

func NewPqErrorTranslator() data.ErrorTranslator

func Use

func Use()

Types

type GormDialector

type GormDialector struct {
	postgres.Dialector
}

func NewGormDialectorWithConfig

func NewGormDialectorWithConfig(config postgres.Config) *GormDialector

func (GormDialector) Migrator

func (d GormDialector) Migrator(db *gorm.DB) gorm.Migrator

type GormMigrator

type GormMigrator struct {
	postgres.Migrator
}

GormMigrator Inverted index support: for now, use PostgreSQL-compatible syntax: https://www.cockroachlabs.com/docs/v20.2/inverted-indexes#creation

func NewGormMigrator

func NewGormMigrator(db *gorm.DB, dialector gorm.Dialector) *GormMigrator

type NoOpDbCreator

type NoOpDbCreator struct{}

func (NoOpDbCreator) CreateDatabaseIfNotExist

func (g NoOpDbCreator) CreateDatabaseIfNotExist(ctx context.Context, db *gorm.DB) error

func (NoOpDbCreator) Order

func (g NoOpDbCreator) Order() int

type PostgresErrorTranslator

type PostgresErrorTranslator struct{}

PostgresErrorTranslator implements data.ErrorTranslator it translates pq.Error and pgconn.PgError to data.DataError Note: cockroach uses gorm.io/driver/postgres, which internally uses github.com/jackc/pgx Ref: - Postgres Error: https://www.postgresql.org/docs/11/protocol-error-fields.html - Postgres Error Code: https://www.postgresql.org/docs/11/errcodes-appendix.html

func (PostgresErrorTranslator) Order

func (t PostgresErrorTranslator) Order() int

func (PostgresErrorTranslator) Translate

func (t PostgresErrorTranslator) Translate(_ context.Context, err error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL