Skip to content

Commit 02087db

Browse files
committed
fix: improve docs
1 parent 58e30a9 commit 02087db

File tree

2 files changed

+246
-43
lines changed

2 files changed

+246
-43
lines changed

CLAUDE.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is **Inflector**, a DuckDB extension that provides string case transformation and inflection capabilities (snake_case, camelCase, pluralization, etc.). It's a DuckDB Community Extension developed by Query.Farm.
8+
9+
## Build Commands
10+
11+
```bash
12+
# Build release version
13+
make release
14+
15+
# Build debug version
16+
make debug
17+
18+
# Run tests (uses SQLLogicTests)
19+
make test # runs release tests
20+
make test_debug # runs debug tests
21+
22+
# Format code
23+
make format
24+
25+
# Update DuckDB submodule
26+
make update
27+
```
28+
29+
All extension functions should be documented inside of DuckDB with CreateScalarFunctionInfo or CreateAggregateFunctionInfo or the appropriate type for the function. This documentation of the function should include examples, parameter types and parameter names. The function should be categorized.
30+
31+
32+
## Architecture
33+
34+
### Hybrid C++/Rust Design
35+
36+
The extension uses a hybrid architecture:
37+
- **C++ layer** (`src/`): DuckDB extension interface, function registration, type handling
38+
- **Rust layer** (`duckdb_inflector_binding/`): String transformation logic using the `cruet` crate
39+
40+
The Rust code compiles to a static library that's linked into the DuckDB extension via CMake + Corrosion.
41+
42+
### Key Files
43+
44+
- `src/inflector_extension.cpp` - Main extension entry point, registers all SQL functions
45+
- `duckdb_inflector_binding/src/lib.rs` - Rust FFI bindings wrapping the `cruet` crate
46+
- `CMakeLists.txt` - Build configuration including Rust/Corrosion setup
47+
- `extension_config.cmake` - DuckDB extension loader configuration
48+
49+
### Function Registration Pattern
50+
51+
The C++ code uses helper functions for registering SQL functions:
52+
- `RegisterInflectorTransform()` - Registers string transformation functions (returns VARCHAR)
53+
- `RegisterInflectorPredicate()` - Registers boolean predicate functions (returns BOOLEAN)
54+
55+
The `inflect()` function has overloads for:
56+
1. Table function - transforms column names in query results
57+
2. Scalar function with VARCHAR - transforms string values
58+
3. Scalar function with STRUCT/ANY - transforms struct field names recursively
59+
60+
### Testing
61+
62+
Tests are SQLLogicTests in `test/sql/`. Run with `make test` or `make test_debug`.
63+
64+
### Cross-Platform Rust Targets
65+
66+
`CMakeLists.txt` handles Rust target selection for various platforms (Linux glibc/musl, macOS arm64/x86_64, Windows MSVC/MinGW, WASM).

0 commit comments

Comments
 (0)