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

neq #24

Merged
merged 1 commit into from
Nov 30, 2023
Merged

neq #24

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions crates/cmds-std/node-definitions/postgrest/builder_neq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"type": "native",
"data": {
"node_definition_version": "0.1",
"unique_id": "",
"node_id": "postgrest_builder_neq",
"version": "0.1",
"display_name": "DB neq",
"description": "https://docs.rs/postgrest/latest/postgrest/struct.Builder.html#method.neq",
"tags": ["database", "postgrest", "supabase"],
"related_to": [
{
"id": "",
"type": "",
"relationship": ""
}
],
"resources": {
"source_code_url": "",
"documentation_url": ""
},
"usage": {
"license": "Apache-2.0",
"license_url": "",
"pricing": {
"currency": "USDC",
"purchase_price": 0,
"price_per_run": 0,
"custom": {
"unit": "monthly",
"value": "0"
}
}
},
"authors": [
{
"name": "Space Operator",
"contact": ""
}
],
"design": {
"width": 0,
"height": 0,
"icon_url": "",
"backgroundColorDark": "#000000",
"backgroundColor": "#fff"
},
"options": {}
},
"targets": [
{
"name": "query",
"type_bounds": ["object"],
"required": true,
"defaultValue": null,
"tooltip": "",
"passthrough": false
},
{
"name": "column",
"type_bounds": ["string"],
"required": true,
"defaultValue": null,
"tooltip": "",
"passthrough": false
},
{
"name": "filter",
"type_bounds": ["string"],
"required": true,
"defaultValue": null,
"tooltip": "",
"passthrough": false
}
],
"sources": [
{
"name": "query",
"type": "object",
"defaultValue": "",
"tooltip": ""
}
],
"targets_form.json_schema": {
"type": "object",
"title": "DB neq",
"properties": {
"column": {
"title": "column",
"type": "string"
},
"filter": {
"title": "filter",
"type": "string"
}
}
},
"targets_form.ui_schema": {
"ui:order": ["column", "filter"]
}
}
43 changes: 43 additions & 0 deletions crates/cmds-std/src/postgrest/builder_neq.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
use flow_lib::command::prelude::*;

const NAME: &str = "postgrest_builder_neq";

#[derive(Deserialize, Debug)]
struct Input {
query: postgrest::Query,
column: String,
filter: String,
}

#[derive(Serialize, Debug)]
struct Output {
query: postgrest::Query,
}

async fn run(ctx: Context, input: Input) -> Result<Output, CommandError> {
Ok(Output {
query: postgrest::Builder::from_query(input.query, ctx.http)
.neq(input.column, input.filter)
.into(),
})
}

fn build() -> BuildResult {
Ok(
CmdBuilder::new(flow_lib::node_definition!("postgrest/builder_neq.json"))?
.check_name(NAME)?
.build(run),
)
}

flow_lib::submit!(CommandDescription::new(NAME, |_| build()));

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_build() {
build().unwrap();
}
}
1 change: 1 addition & 0 deletions crates/cmds-std/src/postgrest/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub mod builder_eq;
pub mod builder_insert;
pub mod builder_is;
pub mod builder_neq;
pub mod builder_order;
pub mod builder_select;
pub mod builder_update;
Expand Down
Loading