Skip to main content

cturtle/btpostgres

include "cturtle/btpostgres";

Types​

PgConfig​

Object

FieldTypeWritableDescription
hoststringyes
servicestringyes
userstringyes
databasestringyes
passwordstringyes
application_namestringyes
scram_noncestringyes
allow_cleartext_passwordboolyes
max_message_bytesintyes

PgDiagnostic​

Object

FieldTypeWritableDescription
severitystringyes
sqlstatestringyes
messagestringyes
detailstringyes
hintstringyes
positionstringyes
internal_positionstringyes
internal_querystringyes
where_textstringyes
schema_namestringyes
table_namestringyes
column_namestringyes
data_type_namestringyes
constraint_namestringyes
filestringyes
linestringyes
routinestringyes

PgNotification​

Object

FieldTypeWritableDescription
process_idintyes
channelstringyes
payloadstringyes

PgField​

Object

FieldTypeWritableDescription
namestringyes
table_oidintyes
column_attributeintyes
type_oidintyes
type_sizeintyes
type_modifierintyes
formatintyes

PgValue​

Object

FieldTypeWritableDescription
is_nullboolyes
bytesbufferyes

text​

fn text() -> string

PgRow​

Object

FieldTypeWritableDescription
valuesarray<PgValue>yes

value​

fn value(int column) -> PgValue

PgResult​

Object

FieldTypeWritableDescription
fieldsarray<PgField>yes
rowsarray<PgRow>yes
command_tagstringyes
affected_rowsintyes

column infallible​

infallible fn column(string name) -> int

PgParameter​

Object

FieldTypeWritableDescription
is_nullboolyes
bytesbufferyes

PgConnection​

Object

FieldTypeWritableDescription
parametersmap<string, string>yes
noticesarray<PgDiagnostic>yes
notificationsarray<PgNotification>yes
last_errorPgDiagnosticyes
backend_process_idintyes
backend_secret_keyintyes
transaction_statusstringyes
tlsboolyes
tls_protocolstringyes
tls_cipherstringyes
tls_server_namestringyes

parameter infallible​

infallible fn parameter(string name) -> string

execute​

fn execute(string sql) -> PgResult

query_params​

fn query_params(string sql, array<PgParameter> values) -> PgResult

close​

fn close()

PgScramState​

Object

FieldTypeWritableDescription
noncestringyes
client_first_barestringyes
server_firststringyes
client_final_without_proofstringyes
expected_server_signaturebufferyes

initial infallible​

infallible fn initial() -> string

respond​

fn respond(string password, string challenge) -> string

respond_with_crypto​

fn respond_with_crypto(
string password,
string challenge,
PgScramCryptoProvider crypto) -> string

verify​

fn verify(string final_message)

verify_with_crypto​

fn verify_with_crypto(string final_message, PgScramCryptoProvider crypto)

clear​

fn clear(PgScramCryptoProvider crypto)

PgWireMessage​

Object

FieldTypeWritableDescription
typeintyes
payloadbufferyes

PgWireString​

Object

FieldTypeWritableDescription
valuestringyes
nextintyes

PgWireStream​

Object

FieldTypeWritableDescription
peerPgTransportyes
inputbufferyes
startintyes
endintyes
limitintyes

Interfaces​

PgScramCryptoProvider​

Interface

sha256​

fn sha256(buffer message, buffer digest)

hmac_sha256​

fn hmac_sha256(buffer key, buffer message, buffer tag)

pbkdf2_sha256​

fn pbkdf2_sha256(
buffer password,
buffer salt,
int iterations,
buffer output)

equal​

fn equal(buffer left, buffer right) -> bool

wipe​

fn wipe(buffer secret)

xor_bytes​

fn xor_bytes(buffer left, buffer right, buffer output)

PgTransport​

Interface

receive​

fn receive(buffer bytes, int offset, int count) -> int

send​

fn send(buffer bytes, int offset, int count) -> int

close infallible​

infallible fn close()

Functions​

pg_sha256​

fn pg_sha256(buffer message) -> buffer

pg_hmac_sha256​

fn pg_hmac_sha256(buffer key, buffer message) -> buffer

pg_pbkdf2_sha256​

fn pg_pbkdf2_sha256(buffer password, buffer salt, int iterations) -> buffer

pg_base64_encode​

fn pg_base64_encode(buffer bytes) -> string

pg_base64_decode​

fn pg_base64_decode(string text) -> buffer

pg_config infallible​

infallible fn pg_config(
string host,
string service,
string user,
string database) -> PgConfig

pg_text​

fn pg_text(string value) -> PgParameter

pg_null infallible​

infallible fn pg_null() -> PgParameter

pg_connect​

fn pg_connect(PgConfig config) -> PgConnection

pg_validate_config​

fn pg_validate_config(PgConfig config)

pg_connect_transport_with_scram_crypto​

fn pg_connect_transport_with_scram_crypto(
PgConfig config,
PgTransport peer,
PgScramCryptoProvider scram_crypto) -> PgConnection

pg_command_rows​

fn pg_command_rows(string tag) -> int

pg_tls_client_config​

fn pg_tls_client_config(
string server_name,
string trust_anchor_pem) -> BtTlsClientConfig

pg_tls_request​

fn pg_tls_request(socket peer)

pg_connect_tls​

fn pg_connect_tls(
PgConfig config,
BtTlsCryptoProvider provider,
BtTlsClientConfig tls_config) -> PgConnection

pg_scram_start​

fn pg_scram_start(string nonce) -> PgScramState

pg_scram_attribute​

fn pg_scram_attribute(string message, string wanted) -> string

pg_wire_stream​

fn pg_wire_stream(PgTransport peer, int limit) -> PgWireStream

pg_wire_read_i16​

fn pg_wire_read_i16(buffer bytes, int offset) -> int

pg_wire_read_i32​

fn pg_wire_read_i32(buffer bytes, int offset) -> int

pg_wire_push_i16​

fn pg_wire_push_i16(buffer bytes, int value)

pg_wire_push_i32​

fn pg_wire_push_i32(buffer bytes, int value)

pg_wire_push_cstring​

fn pg_wire_push_cstring(buffer bytes, string value)

pg_wire_read_cstring​

fn pg_wire_read_cstring(buffer bytes, int offset) -> PgWireString

pg_wire_send_message​

fn pg_wire_send_message(PgTransport peer, int type, buffer payload)

pg_wire_read_message​

fn pg_wire_read_message(PgWireStream stream) -> PgWireMessage