proxy

package
v0.0.0-...-81272bc Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2015 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDeadConn = errors.New("conn is dead")
View Source
var ErrNoRows = errors.New("no rows in result set")
View Source
var ErrNotificationTimeout = errors.New("notification timeout")
View Source
var ErrTLSRefused = errors.New("server refused TLS connection")

Functions

func Start

func Start(localHost, remoteHost *string, remotePort *string, msgBytes chan []byte, msgCh chan Pkg, recreate bool, log *logging.Logger)

Start function

Types

type CommandTag

type CommandTag string

func (CommandTag) RowsAffected

func (ct CommandTag) RowsAffected() int64

RowsAffected returns the number of rows affected. If the CommandTag was not for a row affecting command (such as "CREATE TABLE") then it returns 0

type Conn

type Conn struct {
	Pid           int32             // backend pid
	SecretKey     int32             // key to use to send a cancel query message to the server
	RuntimeParams map[string]string // parameters that have been reported by the server

	TxStatus byte
	// contains filtered or unexported fields
}

Conn is a PostgreSQL connection handle. It is not safe for concurrent usage. Use ConnPool to manage access to multiple database connections from multiple goroutines.

type ConnConfig

type ConnConfig struct {
	Host              string // host (e.g. localhost) or path to unix domain socket directory (e.g. /private/tmp)
	Port              uint16 // default: 5432
	Database          string
	User              string // default: OS user name
	Password          string
	TLSConfig         *tls.Config // config for TLS connection -- nil disables TLS
	UseFallbackTLS    bool        // Try FallbackTLSConfig if connecting with TLSConfig fails. Used for preferring TLS, but allowing unencrypted, or vice-versa
	FallbackTLSConfig *tls.Config // config for fallback TLS connection (only used if UseFallBackTLS is true)-- nil disables TLS
}

ConnConfig contains all the options used to establish a connection.

type FieldDescription

type FieldDescription struct {
	Name            string
	Table           Oid
	AttributeNumber int16
	DataType        Oid
	DataTypeSize    int16
	DataTypeName    string
	Modifier        int32
	FormatCode      int16
}

type Notification

type Notification struct {
	Pid     int32  // backend pid that sent the notification
	Channel string // channel from which notification was received
	Payload string
}

type Oid

type Oid int32

type PgError

type PgError struct {
	Severity         string
	Code             string
	Message          string
	Detail           string
	Hint             string
	Position         int32
	InternalPosition int32
	InternalQuery    string
	Where            string
	SchemaName       string
	TableName        string
	ColumnName       string
	DataTypeName     string
	ConstraintName   string
	File             string
	Line             int32
	Routine          string
}

PgError represents an error reported by the PostgreSQL server. See http://www.postgresql.org/docs/9.3/static/protocol-error-fields.html for detailed field description.

func (PgError) Error

func (self PgError) Error() string

type Pkg

type Pkg struct {
	Type    byte
	Content []byte
	Time    time.Duration
}

Pkg PostgreSQL package structure

type ReadBuf

type ReadBuf []byte

ReadBuf byte array helper

func (*ReadBuf) Byte

func (b *ReadBuf) Byte() byte

Byte get one byte

func (*ReadBuf) Int16

func (b *ReadBuf) Int16() (n int)

Int16 N.B: this is actually an unsigned 16-bit integer, unlike int32

func (*ReadBuf) Int32

func (b *ReadBuf) Int32() (n int)

Int32 get 4 bytes as int32

func (*ReadBuf) Next

func (b *ReadBuf) Next(n int) (v []byte)

Next get next N bytes

func (*ReadBuf) Oid

func (b *ReadBuf) Oid() (n oid.Oid)

Oid get 4 bytes as oid

func (*ReadBuf) String

func (b *ReadBuf) String() string

type WriteBuf

type WriteBuf struct {
	// contains filtered or unexported fields
}

WrifeBuf is used build messages to send to the PostgreSQL server. It is used by the Encoder interface when implementing custom encoders.

func (*WriteBuf) WriteByte

func (wb *WriteBuf) WriteByte(b byte)

func (*WriteBuf) WriteBytes

func (wb *WriteBuf) WriteBytes(b []byte)

func (*WriteBuf) WriteCString

func (wb *WriteBuf) WriteCString(s string)

func (*WriteBuf) WriteInt16

func (wb *WriteBuf) WriteInt16(n int16)

func (*WriteBuf) WriteInt32

func (wb *WriteBuf) WriteInt32(n int32)

func (*WriteBuf) WriteInt64

func (wb *WriteBuf) WriteInt64(n int64)

Jump to

Keyboard shortcuts

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