TCP host:port or Unix socket depending on Network.
AppNamestringDatabasestring
Dial timeout for establishing new connections.
Default is 5 seconds.
Dialer creates new network connection and has priority over
Network and Addr options.
Network type, either tcp or unix.
Default is tcp.
Passwordstring
Timeout for socket reads. If reached, commands will fail
with a timeout instead of blocking.
TLS config for secure connections.
Userstring
Timeout for socket writes. If reached, commands will fail
with a timeout instead of blocking.
verify is a method to make sure if the config is legitimate
in the case it detects any errors, it returns with a non-nil error
it can be extended to check other parameters
func (*Connector).Config() *Config
func newDefaultConfig() *Config
Error represents an error returned by PostgreSQL server
using PostgreSQL ErrorResponse protocol.
https://www.postgresql.org/docs/current/static/protocol-message-formats.html
mmap[byte]string( T) Error() string
Field returns a string value associated with an error field.
https://www.postgresql.org/docs/current/static/protocol-error-fields.html
IntegrityViolation reports whether an error is a part of
Integrity Constraint Violation class of errors.
https://www.postgresql.org/docs/current/static/errcodes-appendix.html
T : error
Reader*bufio.Readerbuf[]byteReader.buf[]byteReader.errerror
// last byte read for UnreadByte; -1 means invalid
// size of last rune read for UnreadRune; -1 means invalid
// buf read and write positions
// reader provided by the client
// buf read and write positions
Buffered returns the number of bytes that can be read from the current buffer.
(*T) Discard(n int) error
Peek returns the next n bytes without advancing the reader. The bytes stop
being valid at the next read call. If Peek returns fewer than n bytes, it
also returns an error explaining why the read is short. The error is
ErrBufferFull if n is larger than b's buffer size.
Calling Peek prevents a UnreadByte or UnreadRune call from succeeding
until the next read operation.
Read reads data into p.
It returns the number of bytes read into p.
The bytes are taken from at most one Read on the underlying Reader,
hence n may be less than len(p).
To read exactly len(p) bytes, use io.ReadFull(b, p).
At EOF, the count will be zero and err will be io.EOF.
ReadByte reads and returns a single byte.
If no byte is available, returns an error.
ReadBytes reads until the first occurrence of delim in the input,
returning a slice containing the data up to and including the delimiter.
If ReadBytes encounters an error before finding a delimiter,
it returns the data read before the error and the error itself (often io.EOF).
ReadBytes returns err != nil if and only if the returned data does not end in
delim.
For simple uses, a Scanner may be more convenient.
ReadLine is a low-level line-reading primitive. Most callers should use
ReadBytes('\n') or ReadString('\n') instead or use a Scanner.
ReadLine tries to return a single line, not including the end-of-line bytes.
If the line was too long for the buffer then isPrefix is set and the
beginning of the line is returned. The rest of the line will be returned
from future calls. isPrefix will be false when returning the last fragment
of the line. The returned buffer is only valid until the next call to
ReadLine. ReadLine either returns a non-nil line or it returns an error,
never both.
The text returned from ReadLine does not include the line end ("\r\n" or "\n").
No indication or error is given if the input ends without a final line end.
Calling UnreadByte after ReadLine will always unread the last byte read
(possibly a character belonging to the line end) even if that byte is not
part of the line returned by ReadLine.
ReadRune reads a single UTF-8 encoded Unicode character and returns the
rune and its size in bytes. If the encoded rune is invalid, it consumes one byte
and returns unicode.ReplacementChar (U+FFFD) with a size of 1.
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.
ReadString reads until the first occurrence of delim in the input,
returning a string containing the data up to and including the delimiter.
If ReadString encounters an error before finding a delimiter,
it returns the data read before the error and the error itself (often io.EOF).
ReadString returns err != nil if and only if the returned data does not end in
delim.
For simple uses, a Scanner may be more convenient.
(*T) ReadTemp(n int) ([]byte, error)
Reset discards any buffered data, resets all state, and switches
the buffered reader to read from r.
Size returns the size of the underlying buffer in bytes.
UnreadByte unreads the last byte. Only the most recently read byte can be unread.
UnreadByte returns an error if the most recent method called on the
Reader was not a read operation. Notably, Peek is not considered a
read operation.
UnreadRune unreads the last rune. If the most recent method called on
the Reader was not a ReadRune, UnreadRune returns an error. (In this
regard it is stricter than UnreadByte, which will unread the last byte
from any read operation.)
WriteTo implements io.WriterTo.
This may make multiple calls to the Read method of the underlying Reader.
If the underlying reader supports the WriteTo method,
this calls the underlying WriteTo without buffering.
collectFragments reads until the first occurrence of delim in the input. It
returns (slice of full buffers, remaining bytes before delim, total number
of bytes in the combined first two elements, error).
The complete result is equal to
`bytes.Join(append(fullBuffers, finalFragment), nil)`, which has a
length of `totalLen`. The result is structured in this way to allow callers
to minimize allocations and copies.
fill reads a new chunk into the buffer.
( T) readErr() error( T) reset(buf []byte, r io.Reader)
writeBuf writes the Reader's buffer to the writer.
T : io.ByteReader
T : io.ByteScanner
T : io.Reader
T : io.RuneReader
T : io.RuneScanner
T : io.WriterTo
T : github.com/vmihailenco/msgpack/v5.bufReader
func newReader(r io.Reader) *reader
func (*Conn).reader(ctx context.Context, timeout time.Duration) *reader
func auth(ctx context.Context, cn *Conn, rd *reader) error
func authCleartext(ctx context.Context, cn *Conn, rd *reader) error
func authMD5(ctx context.Context, cn *Conn, rd *reader) error
func authSASL(ctx context.Context, cn *Conn, rd *reader) error
func readAuthOK(cn *Conn, rd *reader) error
func readBoolCol(rd *reader, n int) (interface{}, error)
func readBytesCol(rd *reader, n int) (interface{}, error)
func readColumnValue(rd *reader, dataType int32, dataLen int) (interface{}, error)
func readError(rd *reader) (error, error)
func readFloatCol(rd *reader, n int, bitSize int) (interface{}, error)
func readInt16(rd *reader) (int16, error)
func readInt32(rd *reader) (int32, error)
func readIntCol(rd *reader, n int, bitSize int) (interface{}, error)
func readMessageType(rd *reader) (byte, int, error)
func readNotification(ctx context.Context, rd *reader) (channel, payload string, err error)
func readRowDescription(rd *reader) (*rowDescription, error)
func readString(rd *reader) (string, error)
func readStringCol(rd *reader, n int) (interface{}, error)
func readTimeCol(rd *reader, n int) (interface{}, error)
func saslReadAuthFinal(cn *Conn, rd *reader) ([]byte, error)
The pages are generated with Goldsv0.3.6. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.