-
Notifications
You must be signed in to change notification settings - Fork 123
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
Replace Query
with a more fitting name
#713
Comments
By the way, the same logic also applies to the names of the Sadly, Rust doesn't seem to have function overloading, so it's not possible to allow the same name |
Function overloading can be simulated to some extent via traits. For example, pub async fn execute(&self, stmt: &impl Executable) {
// ...
} Maybe this could be extended to batches as well. |
There is also potential use case of Batch interface is also a bit weird. Even right now it requires empty elements in values iterator on the positions corresponding to I see 2 main paths forward., correct me if I missed any. KISS, @cvybhu's approachIf we decide to do so, remove Advantages:
Disadvantages:
Executable traitCreate some trait, let's call it Advantages:
Disadvantages:
I like WDYT @piodul ? |
I like the idea of |
@muzarski was this one addressed by the merged PRs or need another PR? |
Today we had a small discussion about it on Slack. There are different opinions on whether we should actually rename the struct or not. I decided to see the naming conventions in our other drivers for reference. So, here it is - the breakdown of execution APIs throughout the drivers Rust driverWe distinguish three kinds of statements: C/C++ driverCpp driver has three different types for statements, but only two session methods for execution. I will describe them briefly. Statement types:
Execution methods:
Python driverHere we will start with execution methods. Because there is only one - Statement types (from
Java driver (4.x)There are a lot of things going on, specific to Java - i.e. a lot of interfaces, subclassing etc. I think the easiest way to tackle this is to focus on Now let's focus on
We can see that API is very similar to Python driver's API (even the same names). GocqlNow this one is a bit confusing to me, and differs by a lot from different drivers. So if I misunderstood something, please correct me. There is only one object representing either unprepared or prepared statement - namely There is a separate set of public API methods/structs for batches. SummaryMost of the drivers stick to
My proposition is to go with |
Confusingly, the driver calls unprepared statement a
Query
(contrary toPreparedStatement
). It's not a correct term and can lead to confusion. "Queries" are statements that ask for data and receive some data in return. "Statement" is a broader term and encompasses items that don't return data but rather modify data or schema, e.g.INSERT
orCREATE
. TheQuery
object has no problems with statements that are not queries.I suggest to rename
Query
to something that fits its purpose better, e.g.UnpreparedStatement
orSimpleStatement
- need to decide upon something, it's probably the best to look at the naming in other drivers. To ease transition to the new name, we will re-introduceQuery
as a type alias, then deprecate and eventually remove at some point.The documentation will have to be adjusted as well as it seems to use "query" and "statement" interchangeably, which is wrong due to the reasons described above but was probably caused by confusion resulting from the existing
Query
name.The text was updated successfully, but these errors were encountered: