返回顶部
s

surrealism

SurrealDB Surrealism WASM extension development. Write Rust functions, compile to WASM, deploy as database modules. Part of the surreal-skills collection.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.2.1
安全检测
已通过
569
下载量
2
收藏
概述
安装方式
版本历史

surrealism

# Surrealism -- WASM Extensions for SurrealDB New in SurrealDB 3. Write custom functions in Rust, compile them to WebAssembly (WASM), and deploy them as native database modules callable from SurrealQL. ## Prerequisites - Rust toolchain (stable) with `wasm32-unknown-unknown` target - SurrealDB CLI v3.0.0+ (`surreal` binary with `surreal module` subcommand) - Familiarity with SurrealQL `DEFINE MODULE` and `DEFINE BUCKET` ## Development Workflow ``` 1. Annotate -- surrealism.toml + #[surrealism] on Rust functions 2. Compile -- surreal module compile (produces .wasm binary) 3. Register -- DEFINE BUCKET + DEFINE MODULE in SurrealQL ``` ## Quick Start ```bash # Create a new Surrealism project cargo new --lib my_extension cd my_extension # Add the WASM target rustup target add wasm32-unknown-unknown # Create surrealism.toml (required manifest) cat > surrealism.toml << 'TOML' [package] name = "my_extension" version = "0.1.0" TOML # Write your extension (annotate with #[surrealism]) cat > src/lib.rs << 'RUST' use surrealism::surrealism; #[surrealism] fn greet(name: String) -> String { format!("Hello, {}!", name) } RUST # Compile to WASM using SurrealDB CLI surreal module compile # Register in SurrealDB surreal sql --endpoint http://localhost:8000 --user root --pass root --ns test --db test ``` ```surql -- Grant access to the WASM file DEFINE BUCKET my_bucket; -- Register the module functions DEFINE MODULE my_extension FROM 'my_bucket:my_extension.wasm'; -- Use the function in queries SELECT my_extension::greet('World'); ``` ## Use Cases - Custom scalar functions callable from SurrealQL - Fake/mock data generation for testing - Domain-specific logic (language processing, quantitative finance, custom encoding) - Access to niche Rust crate functionality too specific for core SurrealDB - Custom analyzers for full-text search ## Status Surrealism is actively in development and not yet stable. The API may change between SurrealDB 3.x releases. File feedback via GitHub issues/PRs on the [surrealdb/surrealdb](https://github.com/surrealdb/surrealdb) repository. ## Full Documentation See the main skill's rule file for complete guidance: - **[rules/surrealism.md](../../rules/surrealism.md)** -- project setup, Rust function signatures, WASM compilation, DEFINE MODULE/BUCKET syntax, deployment, testing, and best practices - **[SurrealDB Extensions Docs](https://surrealdb.com/docs/surrealdb/extensions)** -- official documentation - **[CLI module command](https://surrealdb.com/docs/surrealdb/cli/module)** -- `surreal module` reference

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 surrealism-1776321965 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 surrealism-1776321965 技能

通过命令行安装

skillhub install surrealism-1776321965

下载 Zip 包

⬇ 下载 surrealism v1.2.1

文件大小: 2 KB | 发布时间: 2026-4-16 17:55

v1.2.1 最新 2026-4-16 17:55
No changes detected in this release.

- Version number remains at 1.0.4 in metadata.
- Documentation, descriptions, and usage instructions are unchanged.
- No new features, fixes, or updates included in this version.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部