internal

package
v8.0.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMultiRows = Errorf("pg: multiple rows in result set")
View Source
var ErrNoRows = Errorf("pg: no rows in result set")
View Source
var Logger *log.Logger

Functions

func AssertOneRow

func AssertOneRow(l int) error

func Atoi

func Atoi(b []byte) (int, error)

func BytesToString

func BytesToString(b []byte) string

BytesToString converts byte slice to string.

func CamelCased

func CamelCased(s string) string

func IsLower

func IsLower(c byte) bool

func IsUpper

func IsUpper(c byte) bool

func Logf

func Logf(s string, args ...interface{})

func MakeSliceNextElemFunc

func MakeSliceNextElemFunc(v reflect.Value) func() reflect.Value

func ParseFloat

func ParseFloat(b []byte, bitSize int) (float64, error)

func ParseInt

func ParseInt(b []byte, base int, bitSize int) (int64, error)

func ParseUint

func ParseUint(b []byte, base int, bitSize int) (uint64, error)

func QuoteTableName

func QuoteTableName(s string) string

func RetryBackoff

func RetryBackoff(retry int, minBackoff, maxBackoff time.Duration) time.Duration

Retry backoff with jitter sleep to prevent overloaded conditions during intervals https://www.awsarchitectureblog.com/2015/03/backoff.html

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes converts string to byte slice.

func ToExported

func ToExported(s string) string

func ToLower

func ToLower(c byte) byte

func ToUpper

func ToUpper(c byte) byte

func Underscore

func Underscore(s string) string

Underscore converts "CamelCasedString" to "camel_cased_string".

func UpperString

func UpperString(s string) string

Types

type BufReader

type BufReader struct {
	Columns [][]byte
	// contains filtered or unexported fields
}

func NewBufReader

func NewBufReader(rd io.Reader) *BufReader

func (*BufReader) Available

func (b *BufReader) Available() int

func (*BufReader) Buffered

func (b *BufReader) Buffered() int

Buffered returns the number of bytes that can be read from the current buffer.

func (*BufReader) Bytes

func (b *BufReader) Bytes() []byte

func (*BufReader) BytesReader

func (b *BufReader) BytesReader(n int) *BytesReader

func (*BufReader) Discard

func (b *BufReader) Discard(n int) (discarded int, err error)

Discard skips the next n bytes, returning the number of bytes discarded.

If Discard skips fewer than n bytes, it also returns an error. If 0 <= n <= b.Buffered(), Discard is guaranteed to succeed without reading from the underlying io.BufReader.

func (*BufReader) Read

func (b *BufReader) Read(p []byte) (n int, err error)

func (*BufReader) ReadByte

func (b *BufReader) ReadByte() (byte, error)

func (*BufReader) ReadBytes

func (b *BufReader) ReadBytes(fn func(byte) bool) (line []byte, err error)

func (*BufReader) ReadFull

func (b *BufReader) ReadFull() ([]byte, error)

func (*BufReader) ReadFullTemp

func (b *BufReader) ReadFullTemp() ([]byte, error)

func (*BufReader) ReadN

func (b *BufReader) ReadN(n int) (line []byte, err error)

func (*BufReader) ReadSlice

func (b *BufReader) ReadSlice(delim byte) (line []byte, err error)

ReadSlice reads until the first occurrence of delim in the input, returning a slice pointing at the bytes in the buffer. The bytes stop being valid at the next read. If ReadSlice encounters an error before finding a delimiter, it returns all the data in the buffer and the error itself (often io.EOF). ReadSlice fails with error ErrBufferFull if the buffer fills without a delim. Because the data returned from ReadSlice will be overwritten by the next I/O operation, most clients should use ReadBytes or ReadString instead. ReadSlice returns err != nil if and only if line does not end in delim.

func (*BufReader) Reset

func (b *BufReader) Reset(rd io.Reader)

func (*BufReader) SetAvailable

func (b *BufReader) SetAvailable(n int)

func (*BufReader) UnreadByte

func (b *BufReader) UnreadByte() error

type BytesReader

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

func NewBytesReader

func NewBytesReader(b []byte) *BytesReader

func (*BytesReader) Buffered

func (r *BytesReader) Buffered() int

func (*BytesReader) Bytes

func (r *BytesReader) Bytes() []byte

func (*BytesReader) Discard

func (r *BytesReader) Discard(n int) (int, error)

func (*BytesReader) Read

func (r *BytesReader) Read(b []byte) (n int, err error)

func (*BytesReader) ReadByte

func (r *BytesReader) ReadByte() (byte, error)

func (*BytesReader) ReadBytes

func (r *BytesReader) ReadBytes(fn func(byte) bool) ([]byte, error)

func (*BytesReader) ReadFull

func (r *BytesReader) ReadFull() ([]byte, error)

func (*BytesReader) ReadFullTemp

func (r *BytesReader) ReadFullTemp() ([]byte, error)

func (*BytesReader) ReadN

func (r *BytesReader) ReadN(n int) ([]byte, error)

func (*BytesReader) ReadSlice

func (r *BytesReader) ReadSlice(delim byte) ([]byte, error)

func (*BytesReader) Reset

func (r *BytesReader) Reset(b []byte)

func (*BytesReader) UnreadByte

func (r *BytesReader) UnreadByte() error

type Error

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

func Errorf

func Errorf(s string, args ...interface{}) Error

func (Error) Error

func (err Error) Error() string

type PGError

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

func NewPGError

func NewPGError(m map[byte]string) PGError

func (PGError) Error

func (err PGError) Error() string

func (PGError) Field

func (err PGError) Field(k byte) string

func (PGError) IntegrityViolation

func (err PGError) IntegrityViolation() bool

type Reader

type Reader interface {
	Buffered() int

	Bytes() []byte
	Read([]byte) (int, error)
	ReadByte() (byte, error)
	UnreadByte() error
	ReadSlice(byte) ([]byte, error)
	Discard(int) (int, error)

	//ReadBytes(fn func(byte) bool) ([]byte, error)
	//ReadN(int) ([]byte, error)
	ReadFull() ([]byte, error)
	ReadFullTemp() ([]byte, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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