Documentation
¶
Index ¶
- Constants
- Variables
- func IsDeadlockDetected(err error) bool
- func IsForeignKeyViolation(err error) bool
- func IsSQLState(err error, code string) bool
- func IsSerializationFailure(err error) bool
- func IsUniqueViolation(err error) bool
- func Open(dsn string) (*sql.DB, error)
- func OpenConfig(config Config) (*sql.DB, error)
- type Config
- type Connector
- type Error
- type TLSMode
Constants ¶
View Source
const Version = "1.0.0"
Version is the stable semantic version of the driver.
Variables ¶
View Source
var ErrOperationOutcomeUnknown = errors.New("postgres: connection lost after operation started; outcome is unknown")
ErrOperationOutcomeUnknown means a connection failed after an operation may have reached PostgreSQL. The driver returns this instead of driver.ErrBadConn so database/sql does not retry a potentially non-idempotent statement.
Functions ¶
func IsDeadlockDetected ¶
func IsForeignKeyViolation ¶
func IsSQLState ¶
func IsSerializationFailure ¶
func IsUniqueViolation ¶
Types ¶
type Config ¶
type Config struct {
Host string
Port uint16
User string
Password string
Database string
TLSMode TLSMode
TLSConfig *tls.Config
RootCAs *x509.CertPool
ServerName string
ConnectTimeout time.Duration
CancelTimeout time.Duration
MaxMessageSize int32
ApplicationName string
RuntimeParams map[string]string
// AllowInsecureAuthentication permits cleartext or MD5 password authentication
// on an unencrypted transport. It is false by default.
AllowInsecureAuthentication bool
}
Config contains connection settings for one PostgreSQL server.
func ParseConfig ¶
ParseConfig parses a postgres:// or postgresql:// URL.
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector implements database/sql/driver.Connector.
func NewConnector ¶
type Error ¶
type Error struct {
Severity string
SeverityNonLocal string
Code string
Message string
Detail string
Hint string
Position string
InternalPosition string
InternalQuery string
Where string
Schema string
Table string
Column string
DataType string
Constraint string
File string
Line string
Routine string
}
Error is a structured PostgreSQL ErrorResponse.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.