PostgresNIO Documentation

Classes

Postgres​Connection

A Postgres connection. Use it to run queries against a Postgres server.

Postgres​Listen​Context

Context for receiving NotificationResponse messages on a connection, used for PostgreSQL's LISTEN/NOTIFY support.

Postgres​Message​Decoder
Postgres​Message​Encoder
SASLAuthentication​Manager

Structures

Postgres​Connection.​Configuration

A configuration object for a connection

Postgres​Connection.​Configuration.​Authentication

A structure to configure the connection's authentication properties

Postgres​Connection.​Configuration.​TLS
Postgres​Connection.​Configuration.​Connection
Prepared​Query
Postgres​Numeric
Postgres​Data
Postgres​Data​Type

The data type's raw object ID. Use select * from pg_type where oid = <idhere>; to lookup more information.

Postgres​Row

PostgresRow represents a single table row that is received from the server for a query or a prepared statement. Its element type is PostgresCell.

Postgres​Row.​Iterator
Postgres​Row.​Index
Postgres​Random​Access​Row

A random access row of PostgresCells. Its initialization is O(n) where n is the number of columns in the row. All subsequent cell access are O(1).

Postgres​Message.​Bind

Identifies the message as a Bind command.

Postgres​Message.​Bind.​Parameter
Postgres​Message.​Close

Identifies the message as a Close Command

Postgres​Message.​Command​Complete

Identifies the message as a Close command.

Postgres​Message.​Describe

Identifies the message as a Describe command.

Postgres​Message.​Execute

Identifies the message as an Execute command.

Postgres​Message.​Parameter​Description

Identifies the message as a parameter description.

Postgres​Message.​Parameter​Status
Postgres​Message.​Parse

Identifies the message as a Parse command.

Postgres​Message.​Password

Identifies the message as a password response. Note that this is also used for GSSAPI and SSPI response messages (which is really a design error, since the contained data is not a null-terminated string in that case, but can be arbitrary binary data).

Postgres​Message.​Ready​For​Query

Identifies the message type. ReadyForQuery is sent whenever the backend is ready for a new query cycle.

Postgres​Message.​SASLResponse

SASL ongoing challenge response message sent by the client.

Postgres​Message.​SASLInitial​Response

SASL initial challenge response message sent by the client.

Postgres​Message.​SSLRequest

A message asking the PostgreSQL server if SSL is supported For more info, see https://www.postgresql.org/docs/10/static/protocol-flow.html#id-1.10.5.7.11

Postgres​Message.​Simple​Query

Identifies the message as a simple query.

Postgres​Message.​Startup

First message sent from the frontend during startup.

Postgres​Message.​Sync

Identifies the message as a Bind command.

Postgres​Message.​Terminate
Postgres​Message

A frontend or backend Postgres message.

Postgres​Message.​Backend​Key​Data

Identifies the message as cancellation key data. The frontend must save these values if it wishes to be able to issue CancelRequest messages later.

Postgres​Message.​Data​Row

Identifies the message as a data row.

Postgres​Message.​Data​Row.​Column
Postgres​Message.​Error

First message sent from the frontend during startup.

Postgres​Message.​Identifier

Identifies an incoming or outgoing postgres message. Sent as the first byte, before the message size. Values are not unique across all identifiers, meaning some messages will require keeping state to identify.

Postgres​Message.​Notification​Response

Identifies the message as a notification response.

Postgres​Message.​Row​Description

Identifies the message as a row description.

Postgres​Message.​Row​Description.​Field

Describes a single field returns in a RowDescription message.

Postgres​Decoding​Error

An error that may happen when a PostgresRow or PostgresCell is decoded to native Swift types.

Postgres​Decoding​Error.​Code
Postgres​Cell
Postgres​Encoding​Context

A context that is passed to Swift objects that are encoded into the Postgres wire format. Used to pass further information to the encoding method.

Postgres​Decoding​Context

A context that is passed to Swift objects that are decoded from the Postgres wire format. Used to pass further information to the decoding method.

Postgres​Query

A Postgres SQL query, that can be executed on a Postgres server. Contains the raw sql string and bindings.

Postgres​Query.​String​Interpolation
Postgres​Bindings
Postgres​Row​Sequence

An async sequence of PostgresRows.

Postgres​Row​Sequence.​Async​Iterator
Postgres​Query​Result
Postgres​Query​Metadata
Postgres​Error.​Code

Enumerations

Postgres​Format

The format the postgres types are encoded in on the wire.

Postgres​Message.​Authentication

Authentication request returned by the server.

Postgres​Message.​Close.​Target

Close Target. Determines if the Close command should close a prepared statement or portal.

Postgres​Message.​Describe.​Command

Command type.

Postgres​Message.​Error.​Field
Postgres​Error
SASLAuthentication​Error

Various errors that can occur during SASL negotiation that are not specific to the particular SASL mechanism in use.

SASLAuthentication​Step​Result

Signifies an action to be taken as the result of a single step of a SASL mechanism.

Protocols

Postgres​JSONCodable
Postgres​JSONBCodable
Postgres​Data​Convertible
Postgres​Message​Type
Postgres​Array​Encodable

A type, of which arrays can be encoded into and decoded from a postgres binary format

Postgres​Array​Decodable

A type that can be decoded into a Swift Array of its own type from a Postgres array.

Postgres​Encodable

A type that can encode itself to a postgres wire binary representation.

Postgres​Decodable

A type that can decode itself from a postgres wire binary representation.

Postgres​Database
Postgres​Request

Protocol to encapsulate a function call on the Postgres server

Postgres​JSONDecoder

A protocol that mimicks the Foundation JSONDecoder.decode(_:from:) function. Conform a non-Foundation JSON decoder to this protocol if you want PostgresNIO to be able to use it when decoding JSON & JSONB values (see PostgresNIO._defaultJSONDecoder)

Postgres​JSONEncoder

A protocol that mimicks the Foundation JSONEncoder.encode(_:) function. Conform a non-Foundation JSON encoder to this protocol if you want PostgresNIO to be able to use it when encoding JSON & JSONB values (see PostgresNIO._defaultJSONEncoder)

SASLAuthentication​Mechanism

The protocol to which all SASL mechanism implementations must conform. It is the responsibility of each individual implementation to provide an API for creating instances of itself which are able to retrieve information from the caller (such as usernames and passwords) by some mechanism.

Typealiases

Postgres​Format​Code

Variables

_default​JSONDecoder

The default JSON decoder used by PostgresNIO when decoding JSON & JSONB values. As _defaultJSONDecoder will be reused for decoding all JSON & JSONB values from potentially multiple threads at once, you must ensure your custom JSON decoder is thread safe internally like Foundation.JSONDecoder.

_default​JSONEncoder

The default JSON encoder used by PostgresNIO when encoding JSON & JSONB values. As _defaultJSONEncoder will be reused for encoding all JSON & JSONB values from potentially multiple threads at once, you must ensure your custom JSON encoder is thread safe internally like Foundation.JSONEncoder.

Extensions

Array
Bool
ByteBuffer
Data
Date
Decimal
Double
Float
Int
Int16
Int32
Int64
Int8
Optional
RawRepresentable
Set
String
UInt
UInt16
UInt32
UInt64
UInt8
UUID