Versions in this module Expand all Collapse all v0 v0.2.0 Dec 2, 2025 v0.1.0 Nov 26, 2025 v0.0.4 Nov 26, 2025 Changes in this version + const DefaultApplicationName + const DefaultConnMaxIdleTime + const DefaultConnMaxLifetime + const DefaultConnectTimeout + const DefaultHost + const DefaultMaxIdleConns + const DefaultMaxOpenConns + const DefaultPort + const DefaultQueryTimeout + const DefaultSSLMode + const ErrCodeAdminShutdown + const ErrCodeCannotConnectNow + const ErrCodeCheckViolation + const ErrCodeConnectionException + const ErrCodeConnectionFailure + const ErrCodeCrashShutdown + const ErrCodeDeadlockDetected + const ErrCodeDiskFull + const ErrCodeDuplicateColumn + const ErrCodeDuplicateTable + const ErrCodeExclusionViolation + const ErrCodeForeignKeyViolation + const ErrCodeInsufficientResources + const ErrCodeInvalidSchemaName + const ErrCodeNotNullViolation + const ErrCodeOutOfMemory + const ErrCodeSQLClientCannotConnect + const ErrCodeSerializationFailure + const ErrCodeTooManyConnections + const ErrCodeUndefinedColumn + const ErrCodeUndefinedTable + const ErrCodeUniqueViolation + var ErrPostgresConnectionFailed medaerror.MedaError = medaerror.MedaError + var ErrPostgresInvalidConfig medaerror.MedaError = medaerror.MedaError + var ErrPostgresInvalidDSN medaerror.MedaError = medaerror.MedaError + var ErrPostgresNoAffectedRows medaerror.MedaError = medaerror.MedaError + var ErrPostgresNotConnected medaerror.MedaError = medaerror.MedaError + var ErrPostgresQueryFailed medaerror.MedaError = medaerror.MedaError + var ErrPostgresTimeout medaerror.MedaError = medaerror.MedaError + var ErrPostgresTransactionFailed medaerror.MedaError = medaerror.MedaError + func ConvertPostgreSQLError(err error) error + func FormatPostgreSQLError(err error) string + func GetPostgreSQLErrorCode(err error) string + func GetPostgreSQLErrorDetail(err error) (code, message, detail, hint string) + func IsCheckViolation(err error) bool + func IsConnectionError(err error) bool + func IsConstraintViolation(err error) bool + func IsDeadlock(err error) bool + func IsDuplicateColumn(err error) bool + func IsDuplicateTable(err error) bool + func IsForeignKeyViolation(err error) bool + func IsInsufficientResources(err error) bool + func IsNotNullViolation(err error) bool + func IsRetryable(err error) bool + func IsSerializationFailure(err error) bool + func IsTooManyConnections(err error) bool + func IsUndefinedColumn(err error) bool + func IsUndefinedTable(err error) bool + func IsUniqueViolation(err error) bool + func WrapPostgreSQLError(err error, operation, table, query string) error + type PostgreSQLError struct + Code string + Detail string + Err error + Hint string + Message string + Operation string + Query string + Table string + func (e *PostgreSQLError) Error() string + func (e *PostgreSQLError) Unwrap() error + type PostgresConfig struct + ApplicationName string + ConnMaxIdleTime time.Duration + ConnMaxLifetime time.Duration + ConnectTimeout time.Duration + DBName string + ExtraParams map[string]string + Host string + MaxIdleConns int + MaxOpenConns int + Password string + Port int + QueryTimeout time.Duration + SSLMode string + SearchPath string + Timezone string + User string + func NewConfig(host string, port int, user, password, dbName string) *PostgresConfig + func NewDefaultConfig() *PostgresConfig + func ParseDSN(dsn string) (*PostgresConfig, error) + func (c *PostgresConfig) Clone() *PostgresConfig + func (c *PostgresConfig) String() string + func (c *PostgresConfig) ToDSN() (string, error) + func (c *PostgresConfig) ToSimpleDSN() (string, error) + func (c *PostgresConfig) Validate() error + func (c *PostgresConfig) WithApplicationName(name string) *PostgresConfig + func (c *PostgresConfig) WithConnectionPool(maxOpen, maxIdle int, maxLifetime, maxIdleTime time.Duration) *PostgresConfig + func (c *PostgresConfig) WithExtraParam(key, value string) *PostgresConfig + func (c *PostgresConfig) WithSSLMode(mode string) *PostgresConfig + func (c *PostgresConfig) WithSearchPath(path string) *PostgresConfig + func (c *PostgresConfig) WithTimeouts(connectTimeout, queryTimeout time.Duration) *PostgresConfig + func (c *PostgresConfig) WithTimezone(tz string) *PostgresConfig + type PostgresDirectDB = *postgres + func NewDatabase(config PostgresConfig) (PostgresDirectDB, error)