Skip to content

Commit

Permalink
[ci] Run doctests #1275 (#1276)
Browse files Browse the repository at this point in the history
* fix doctests

* Update agdb.yaml

* Update agdb_api_rust.yaml
  • Loading branch information
michaelvlach authored Sep 16, 2024
1 parent 5299e09 commit e4c1691
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 16 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/agdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ jobs:
- run: rustup component add llvm-tools-preview
- run: cargo llvm-cov --package agdb --package agdb_derive --all-features --ignore-filename-regex "agdb_derive" --fail-uncovered-functions 0 --fail-uncovered-lines 0 --show-missing-lines

agdb_doctest:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo test --package agdb --package agdb_derive --all-features --doc

agdb_format:
runs-on: ubuntu-latest
needs: diff
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/agdb_api_rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ jobs:
- run: rustup component add llvm-tools-preview
- run: cargo llvm-cov --package agdb_api --package agdb_server --all-features --ignore-filename-regex "agdb(.|..)src|agdb_server|agdb_derive" --fail-uncovered-functions 0 --fail-uncovered-lines 0 --show-missing-lines

agdb_api_rust_doctest:
runs-on: ubuntu-latest
needs: diff
if: needs.diff.outputs.diff == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo test --package agdb_api --doc --all-features

agdb_api_rust_format:
runs-on: ubuntu-latest
needs: diff
Expand Down
5 changes: 3 additions & 2 deletions agdb/src/query_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl QueryBuilder {
/// QueryBuilder::remove().index("k");
/// QueryBuilder::remove().aliases("a");
/// QueryBuilder::remove().aliases(["a", "b"]);
/// QueryBuilder::remove().values(vec!["k".into()]);
/// QueryBuilder::remove().values("k");
/// ```
pub fn remove() -> Remove {
Remove {}
Expand Down Expand Up @@ -110,6 +110,7 @@ impl QueryBuilder {
/// ```
/// use agdb::QueryBuilder;
/// use agdb::UserValue;
/// use agdb::DbId;
///
/// #[derive(UserValue)]
/// struct MyValue { db_id: Option<DbId>, key: String }
Expand All @@ -122,7 +123,7 @@ impl QueryBuilder {
/// QueryBuilder::select().keys();
/// QueryBuilder::select().key_count();
/// QueryBuilder::select().node_count();
/// QueryBuilder::select().values(vec!["k".into()]);
/// QueryBuilder::select().values("k");
/// ```
pub fn select() -> Select {
Select {}
Expand Down
6 changes: 3 additions & 3 deletions agdb/src/query_builder/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ impl Remove {
/// ```
/// use agdb::QueryBuilder;
///
/// QueryBuilder::remove().values(vec!["k".into()]).ids(1);
/// QueryBuilder::remove().values(vec!["k".into()]).ids(vec![1]);
/// QueryBuilder::remove().values(vec!["k".into()]).ids(QueryBuilder::search().from(1).query());
/// QueryBuilder::remove().values("k").ids(1);
/// QueryBuilder::remove().values("k").ids(vec![1]);
/// QueryBuilder::remove().values("k").ids(QueryBuilder::search().from(1).query());
/// ```
pub fn values<T: Into<DbValues>>(self, keys: T) -> RemoveValues {
RemoveValues(RemoveValuesQuery(SelectValuesQuery {
Expand Down
10 changes: 5 additions & 5 deletions agdb/src/query_builder/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl SearchFrom {
/// QueryBuilder::search().from(1).where_().edge();
/// QueryBuilder::search().from(1).where_().distance(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().ids(1);
/// QueryBuilder::search().from(1).where_().keys(vec!["k".into()]);
/// QueryBuilder::search().from(1).where_().keys("k");
/// QueryBuilder::search().from(1).where_().key("k");
/// QueryBuilder::search().from(1).where_().edge_count(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1));
Expand Down Expand Up @@ -383,7 +383,7 @@ impl SearchOrderBy {
/// QueryBuilder::search().from(1).where_().edge();
/// QueryBuilder::search().from(1).where_().distance(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().ids(1);
/// QueryBuilder::search().from(1).where_().keys(vec!["k".into()]);
/// QueryBuilder::search().from(1).where_().keys("k");
/// QueryBuilder::search().from(1).where_().key("k");
/// QueryBuilder::search().from(1).where_().edge_count(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1));
Expand Down Expand Up @@ -476,7 +476,7 @@ impl SearchTo {
/// QueryBuilder::search().from(1).where_().edge();
/// QueryBuilder::search().from(1).where_().distance(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().ids(1);
/// QueryBuilder::search().from(1).where_().keys(vec!["k".into()]);
/// QueryBuilder::search().from(1).where_().keys("k");
/// QueryBuilder::search().from(1).where_().key("k");
/// QueryBuilder::search().from(1).where_().edge_count(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1));
Expand Down Expand Up @@ -508,7 +508,7 @@ impl SelectLimit {
/// QueryBuilder::search().from(1).where_().edge();
/// QueryBuilder::search().from(1).where_().distance(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().ids(1);
/// QueryBuilder::search().from(1).where_().keys(vec!["k".into()]);
/// QueryBuilder::search().from(1).where_().keys("k");
/// QueryBuilder::search().from(1).where_().key("k");
/// QueryBuilder::search().from(1).where_().edge_count(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1));
Expand Down Expand Up @@ -559,7 +559,7 @@ impl SelectOffset {
/// QueryBuilder::search().from(1).where_().edge();
/// QueryBuilder::search().from(1).where_().distance(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().ids(1);
/// QueryBuilder::search().from(1).where_().keys(vec!["k".into()]);
/// QueryBuilder::search().from(1).where_().keys("k");
/// QueryBuilder::search().from(1).where_().key("k");
/// QueryBuilder::search().from(1).where_().edge_count(CountComparison::Equal(1));
/// QueryBuilder::search().from(1).where_().edge_count_from(CountComparison::Equal(1));
Expand Down
12 changes: 6 additions & 6 deletions agdb/src/query_builder/where_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Where {
/// use agdb::{QueryBuilder, CountComparison};
///
/// // Only elements with `k` key will be followed during search.
/// QueryBuilder::search().from(1).where_().beyond().keys(vec!["k".into()]).query();
/// QueryBuilder::search().from(1).where_().beyond().keys("k").query();
///
/// // Only edges or nodes with exactly 1 edge are followed.
/// QueryBuilder::search().from(1).where_().beyond().edge().or().edge_count(CountComparison::Equal(1));
Expand Down Expand Up @@ -213,10 +213,10 @@ impl Where {
/// use agdb::QueryBuilder;
///
/// // Include only elements with "k" property (key)
/// QueryBuilder::search().from(1).where_().keys(vec!["k".into()]).query();
/// QueryBuilder::search().from(1).where_().keys("k").query();
///
/// // Includes only elements with either "a" or "b" properties (keys).
/// QueryBuilder::search().from(1).where_().keys(vec!["a".into()]).or().keys(vec!["b".into()]).query();
/// QueryBuilder::search().from(1).where_().keys("a").or().keys("b").query();
/// ```
pub fn keys<T: Into<DbValues>>(mut self, keys: T) -> WhereLogicOperator {
self.add_condition(QueryCondition {
Expand Down Expand Up @@ -256,7 +256,7 @@ impl Where {
/// use agdb::QueryBuilder;
///
/// // Includes elements WITHOUT the "k" property (key).
/// QueryBuilder::search().from(1).where_().not().keys(vec!["k".into()]).query();
/// QueryBuilder::search().from(1).where_().not().keys("k").query();
/// ```
pub fn not(mut self) -> Self {
self.modifier = QueryConditionModifier::Not;
Expand All @@ -275,7 +275,7 @@ impl Where {
/// use agdb::{QueryBuilder, CountComparison};
///
/// // Elements with `k` key will NOT be followed during search.
/// QueryBuilder::search().from(1).where_().not_beyond().keys(vec!["k".into()]).query();
/// QueryBuilder::search().from(1).where_().not_beyond().keys("k").query();
///
/// // Elements 1 and 2 will NOT be followed during search.
/// QueryBuilder::search().from(1).where_().not_beyond().ids(vec![1, 2]);
Expand Down Expand Up @@ -306,7 +306,7 @@ impl Where {
/// .and()
/// .beyond()
/// .where_()
/// .keys(vec!["k".into()])
/// .keys("k")
/// .or()
/// .node()
/// .query();
Expand Down

0 comments on commit e4c1691

Please sign in to comment.