Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split api feature #177

Merged
merged 5 commits into from
Apr 25, 2024
Merged

Split api feature #177

merged 5 commits into from
Apr 25, 2024

Conversation

wyhaya
Copy link
Contributor

@wyhaya wyhaya commented Apr 25, 2024

This PR split the "server" into the api feature, which can significantly reduce the compilation time for those who just want to use the messages to write a Postgres client.

# Consistent with before, there are no breaking changes
pgwire = "..."

# Only messages
# 120+ crates -> 14 crates
pgwire = { version = "...", default-features = false }

Two unused crates have been deleted.

log = "0.4"
time = "0.3"

Export FORMAT_CODE

This helps the client determine the value format

- pub(crate) const FORMAT_CODE_TEXT: i16 = 0;
+ pub const FORMAT_CODE_TEXT: i16 = 0;

@@ -18,7 +17,7 @@ pub struct FieldDescription {
// the attribute number of the column, default to 0 if not a column from table
pub column_id: i16,
// the object ID of the data type
pub type_id: Oid,
pub type_id: u32,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pub type Oid = u32;

Oid is just an alias for u32, to avoid introducing postgres_types, we restore it here.

@sunng87
Copy link
Owner

sunng87 commented Apr 25, 2024

LGTM. This is great addition to keep the library compact. I will be adding more feature gates to various authentication methods too.

I'm curious how you are using this library in your application, for message format only?

@wyhaya
Copy link
Contributor Author

wyhaya commented Apr 25, 2024

I'm curious how you are using this library in your application, for message format only?

My application need to run simple query, but also need to obtain columns/rows(text format) or affected rows (I don't know whether to call execute or query.).
It seems that neither tokio-postgres nor sqlx can meet the demands, so I decided to start writing a pg client from scratch, messages completely meets my needs.

Thank you very much for writing pgwire!

@sunng87
Copy link
Owner

sunng87 commented Apr 25, 2024

That's great to hear. I think there can be some use-case on client side and it becomes true.

I will merge this and rename the api feature to server-api in case that you may want to upstream some of your client implementation, as client-api

@sunng87 sunng87 merged commit ebfe5aa into sunng87:master Apr 25, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants