postgresql

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort      = "5432"
	NotAvailableLock = "55P03"
)

Variables

This section is empty.

Functions

func ConnectTimeout

func ConnectTimeout(t time.Duration) dialects.Option

func Env

func Env(env *Environment) dialects.Option

func Extension

func Extension(f dialects.Extension) dialects.Option

func FallbackApplicationName

func FallbackApplicationName(name string) dialects.Option

func PreferSimpleProtocol

func PreferSimpleProtocol(simple *bool) dialects.Option

func SSLCert

func SSLCert(location string) dialects.Option

func SSLKey

func SSLKey(location string) dialects.Option

func SSLMode

func SSLMode(value SSLOption) dialects.Option

func SSLRootCert

func SSLRootCert(location string) dialects.Option

Types

type Builder

type Builder struct {
	SslMode                 string
	FallbackApplicationName string
	ConnectTimeout          time.Duration
	SslCert                 string
	SslKey                  string
	SslRootCert             string
	PreferSimpleProtocol    bool
	Extension               dialects.Extension
}

func New

func New(options ...dialects.Option) *Builder

func (*Builder) Build

func (b *Builder) Build(user, password, host string, port int, dbname string) gorm.Dialector

func (*Builder) BuildDialector

func (b *Builder) BuildDialector(url string) gorm.Dialector

func (*Builder) BuildString

func (b *Builder) BuildString(user, password, host string, port int, dbname string) string

func (*Builder) IsNotAvailableLock

func (b *Builder) IsNotAvailableLock(err error) bool

func (*Builder) Name

func (b *Builder) Name() string

type Environment

type Environment struct {
	SslMode                 string
	FallbackApplicationName string
	ConnectTimeout          string
	SslCert                 string
	SslKey                  string
	SslRootCert             string
	PreferSimpleProtocol    string
}

func (*Environment) Build

func (env *Environment) Build(b *Builder)

type SSLOption

type SSLOption string
const (
	// disable - No SSL
	SslDisable SSLOption = "disable"
	// require - Always SSL (skip verification)
	SslRequire SSLOption = "require"
	// verify-ca - Always SSL (verify that the certificate presented by the
	// server was signed by a trusted CA)
	SslVerifyCa SSLOption = "verify-ca"
	// verify-full - Always SSL (verify that the certification presented by the
	// server was signed by a trusted CA and the server host name matches the one in the certificate)
	SslVerifyFull SSLOption = "verify-full"
)

Jump to

Keyboard shortcuts

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