After the Bolt handshake, the negotiated capabilities (bolt version, server version, policy) are stored in Bolty.Connection state but are not accessible to callers.
Since this information is already present on the checked-out connection, the natural place to expose it is via the conn passed into a transaction/3 callback or checkout:
Bolty.transaction(Bolt, fn conn ->
Bolty.connection_info(conn)
# => %{bolt_version: 5.4, server_version: "Neo4j/5.20.0", policy: %Bolty.Policy{...}}
end)
Including the full Bolty.Policy struct allows callers to inspect fine-grained negotiated behaviour (e.g. datetime encoding) if they want it, while callers that only need bolt_version can ignore the rest. Each caller decides how coupled to the internals they want to be.
For callers that need this information before any transaction, a brief checkout suffices — but that's an edge case best handled with a thin helper on top.
After the Bolt handshake, the negotiated capabilities (bolt version, server version, policy) are stored in
Bolty.Connectionstate but are not accessible to callers.Since this information is already present on the checked-out connection, the natural place to expose it is via the
connpassed into atransaction/3callback or checkout:Including the full
Bolty.Policystruct allows callers to inspect fine-grained negotiated behaviour (e.g. datetime encoding) if they want it, while callers that only needbolt_versioncan ignore the rest. Each caller decides how coupled to the internals they want to be.For callers that need this information before any transaction, a brief checkout suffices — but that's an edge case best handled with a thin helper on top.