PostgresNIO Documentation

Protocol Postgres​Encodable

public protocol PostgresEncodable  

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

%17 PostgresEncodable PostgresEncodable PostgresArrayEncodable PostgresArrayEncodable PostgresArrayEncodable->PostgresEncodable PostgresCodable PostgresCodable PostgresCodable->PostgresEncodable

Types Conforming to Postgres​Encodable

PostgresArrayEncodable

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

Default Implementations

psql​Type

public static var psqlType: PostgresDataType  

psql​Format

public static var psqlFormat: PostgresFormat  

encode(into:​context:​)

@inlinable
    public func encode<JSONEncoder: PostgresJSONEncoder>(
        into byteBuffer: inout ByteBuffer,
        context: PostgresEncodingContext<JSONEncoder>
    )  

psql​Type

public static var psqlType: PostgresDataType  

psql​Format

public static var psqlFormat: PostgresFormat  

encode(into:​context:​)

@inlinable
    public func encode<JSONEncoder: PostgresJSONEncoder>(
        into byteBuffer: inout ByteBuffer,
        context: PostgresEncodingContext<JSONEncoder>
    ) throws  

psql​Type

public static var psqlType: PostgresDataType  

psql​Format

public static var psqlFormat: PostgresFormat  

encode(into:​context:​)

@inlinable
    public func encode<JSONEncoder: PostgresJSONEncoder>(
        into byteBuffer: inout ByteBuffer,
        context: PostgresEncodingContext<JSONEncoder>
    ) throws  

Requirements

psql​Type

static var psqlType: PostgresDataType  

identifies the data type that we will encode into byteBuffer in encode

psql​Format

static var psqlFormat: PostgresFormat  

identifies the postgres format that is used to encode the value into byteBuffer in encode

encode(into:​context:​)

func encode<JSONEncoder: PostgresJSONEncoder>(into byteBuffer: inout ByteBuffer, context: PostgresEncodingContext<JSONEncoder>) throws

Encode the entity into the byteBuffer in Postgres binary format, without setting the byte count. This method is called from the PostgresBindings.