Module pg3

Module pg3 

Source
Expand description

Postgres relational database storage for Spin 3.3 and earlier. Applications that do not require this backward compatibility should use the pg4 module instead.

You can use the into() method to convert a Rust value into a ParameterValue. You can use the Decode trait to convert a DbValue to a suitable Rust type. The following table shows available conversions.

§Types

Rust typeWIT (db-value)Postgres type(s)
boolboolean(bool)BOOL
i16int16(s16)SMALLINT, SMALLSERIAL, INT2
i32int32(s32)INT, SERIAL, INT4
i64int64(s64)BIGINT, BIGSERIAL, INT8
f32floating32(float32)REAL, FLOAT4
f64floating64(float64)DOUBLE PRECISION, FLOAT8
Stringstr(string)VARCHAR, CHAR(N), TEXT
Vec<u8>binary(list<u8>)BYTEA
chrono::NaiveDatedate(tuple<s32, u8, u8>)DATE
chrono::NaiveTimetime(tuple<u8, u8, u8, u32>)TIME
chrono::NaiveDateTimedatetime(tuple<s32, u8, u8, u8, u8, u8, u32>)TIMESTAMP
chrono::Durationtimestamp(s64)BIGINT

Structs§

Column
A database column
Connection
An open connection to a PostgreSQL database.
RowSet
The result of a database query.

Enums§

DbDataType
Data types for a database column
DbValue
Database values
Error
A Postgres error
Error
Errors related to interacting with a database.
ParameterValue
Values used in parameterized queries
PgError
Errors related to interacting with a database.

Traits§

Decode
A type that can be decoded from the database.

Type Aliases§

Row
A database row