Documentation ¶
Overview ¶
Package psqlutil provides PostgreSQL utility functions, offering the most common operations in the PSQL ecosystem.
Index ¶
- Variables
- func ComposeDSN(host, port, user, password, dbName, sslMode string) string
- func GormOpen(ctx context.Context, zapLogger *zap.Logger, driver string, postgresDSN string) (*gorm.DB, error)
- func MustNewSQL(db *sql.DB, err error) *sql.DB
- func ReadSchema(projectDirectoryName string) (string, error)
- func SQLOpen(ctx context.Context, driver, postgresDSN string) (*sql.DB, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDirectoryNotFound = errors.New("wallee directory not found")
ErrDirectoryNotFound is returned when the project directory is not found.
View Source
var ErrUnableToResolveCaller = errors.New("unable to resolve caller")
ErrUnableToResolveCaller is returned when the caller CWD cannot be retrieved.
Functions ¶
func ComposeDSN ¶ added in v0.0.4
ComposeDSN returns a PostgreSQL Data Source Name.
func GormOpen ¶
func GormOpen( ctx context.Context, zapLogger *zap.Logger, driver string, postgresDSN string, ) (*gorm.DB, error)
GormOpen opens a new db connection and returns a *gorm.DB.
func MustNewSQL ¶
MustNewSQL panics if err is not nil, otherwise it returns db.
func ReadSchema ¶ added in v0.0.2
ReadSchema reads schema dynamically based on the CWD of the caller.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.