Skip to content

Commit 1cc50b2

Browse files
Self review changes
1 parent c823631 commit 1cc50b2

File tree

6 files changed

+32
-9
lines changed

6 files changed

+32
-9
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[#_struct_VariableInfo]
2+
=== VariableInfo
3+
4+
*Implements traits:*
5+
6+
* `Clone`
7+
* `Debug`
8+
9+
Holds information about variables in a ``Pipeline``.
10+
11+
[caption=""]
12+
.Fields
13+
// tag::properties[]
14+
[cols=",,"]
15+
[options="header"]
16+
|===
17+
|Name |Type |Description
18+
a| `name` a| `String` a|
19+
|===
20+
// end::properties[]
21+

docs/modules/ROOT/partials/rust/transaction/Transaction.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
A transaction with a TypeDB database.
99
1010
// tag::methods[]
11-
[#_struct_Transaction_analyze_query_query_impl_AsRef_str_]
12-
==== analyze_query
11+
[#_struct_Transaction_analyze_query_impl_AsRef_str_]
12+
==== analyze
1313

1414
[source,rust]
1515
----
16-
pub fn analyze_query(
16+
pub fn analyze(
1717
&self,
1818
query: impl AsRef<str>,
1919
) -> impl Promise<'static, Result<AnalyzedQuery>>
@@ -41,7 +41,7 @@ impl Promise<'static, Result<AnalyzedQuery>>
4141
.Code examples
4242
[source,rust]
4343
----
44-
transaction.analyze_query(query)
44+
transaction.analyze(query)
4545
----
4646

4747
[#_struct_Transaction_close_]

rust/src/analyze/conjunction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub enum Constraint {
9292
},
9393
Expression {
9494
text: String,
95-
assigned: Vec<ConstraintVertex>,
95+
assigned: ConstraintVertex,
9696
arguments: Vec<ConstraintVertex>,
9797
},
9898
Is {

rust/src/connection/network/proto/analyze.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@ impl TryFromProto<conjunction_proto::StructureConstraint> for Constraint {
292292
}
293293
ConstraintProto::Expression(constraint_proto::Expression { assigned, arguments, text }) => {
294294
Constraint::Expression {
295-
assigned: vec_from_proto(assigned)?,
295+
assigned: vec_from_proto(assigned)?.first().cloned().ok_or_else(|| {
296+
AnalyzeError::MissingResponseField { field: "Expression.assigned was an empty array" }
297+
})?,
296298
arguments: vec_from_proto(arguments)?,
297299
text,
298300
}

rust/src/transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ impl Transaction {
9393
/// # Examples
9494
///
9595
/// ```rust
96-
/// transaction.analyze_query(query)
96+
/// transaction.analyze(query)
9797
/// ```
98-
pub fn analyze_query(&self, query: impl AsRef<str>) -> impl Promise<'static, Result<AnalyzedQuery>> {
98+
pub fn analyze(&self, query: impl AsRef<str>) -> impl Promise<'static, Result<AnalyzedQuery>> {
9999
self.transaction_stream.analyze(query.as_ref())
100100
}
101101

rust/tests/behaviour/steps/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub(crate) async fn run_analyze_query(
3333
transaction: &Transaction,
3434
query: impl AsRef<str>,
3535
) -> TypeDBResult<AnalyzedQuery> {
36-
transaction.analyze_query(query).await
36+
transaction.analyze(query).await
3737
}
3838

3939
#[apply(generic_step)]

0 commit comments

Comments
 (0)