Expand description
Crate to write Shopify Functions in Rust.
This crate provides some convenience when building Shopify Functions using Rust. The crate takes care of generating the required Rust structs to handle the data types being passed between Shopify and the Function. The crate also takes care of deserializing the input data and serializing the output data.
ⓘ
use shopify_function::prelude::*
#[typegen("./schema.graphql")]
mod schema {
#[query("./input.graphql")]
pub mod input {}
}
#[shopify_function]
fn run(input: schema::input::Input) -> Result<schema::FunctionRunResult> {
/* ... */
}
Re-exports§
pub use shopify_function_wasm_api as wasm_api;
Modules§
Functions§
- run_
function_ with_ input - Runs the given function
f
with the invocation payload, returning the deserialized output. This function is provided as a helper when writing tests.
Type Aliases§
Attribute Macros§
- shopify_
function - Generates code for a Function. This will define a wrapper function that is exported to Wasm. The wrapper handles deserializing the input and serializing the output.
- typegen
- Generates Rust types from GraphQL schema definitions and queries.
Derive Macros§
- Deserialize
- Derives the
Deserialize
trait for structs to deserialize values from shopify_function_wasm_api::Value.