Python SDK for the Helix Configuration Language
Project description
HLX - The Beautiful Configuration & Data Processing System
HLX is a powerful, elegant configuration and data processing system built in Rust. It combines the simplicity of configuration files with the power of a full programming language, featuring 38+ built-in operators for data manipulation, encoding, hashing, mathematical operations, and more.
โจ What Makes HLX Beautiful?
๐ฏ Elegant Syntax
project "MyAwesomeApp" :
version = "1.1.9"
environment = @env var=ENV default=development
api_key = @base64 input=my-secret-key operation=encode
timestamp = @timestamp
uuid = @uuid
;
agent "DataProcessor" :
name = "HLX Data Engine"
capabilities = ["processing", "encoding", "hashing"]
max_connections = @math operation=mul a=100 b=10
hash_algorithm = "sha256"
;
๐ 39+ Powerful Operators
Basic Operations
@uuid- Generate unique identifiers@timestamp- Current Unix timestamps@now- ISO datetime strings@exec- Execute shell commands and external programs
Data Processing
@base64- Encode/decode Base64 data@json- Parse/stringify JSON@url- URL encoding/decoding@hash- SHA256/MD5 hashing
String Manipulation
@string- Transform, analyze, extract text@env- Environment variable access@var- Global variable management
Mathematical Operations
@math- Arithmetic operations (add, sub, mul, div, pow)@calc- Expression evaluation@min,@max,@avg,@sum- Statistical functions
Control Flow
@if,@switch- Conditional logic@and,@or,@not- Logical operations
Web Integration
@session,@cookie- Session management@param,@header- HTTP context access
๐ง Easy Integration
Set All Operators Example
//! HLX Set All Operators Example
use helix::{Hlx, xlh, DnaValue as Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("=== HLX Set All Operators Example ===");
let mut hlx = Hlx::new().await?;
// Basic Operators (No Parameters)
println!("\n--- Setting Basic Operators ---");
// @uuid - Generate random UUIDs (v4)
let uuid_result = xlh(&hlx, "@uuid", "").await;
if let Ok(Value::String(uuid)) = uuid_result {
hlx.set("basic", "uuid", Value::String(uuid.clone()));
println!("โ
UUID: {}", uuid);
}
// @timestamp - Generate current Unix timestamps
let timestamp_result = xlh(&hlx,"@timestamp", "").await;
if let Ok(Value::Number(timestamp)) = timestamp_result {
hlx.set("basic", "timestamp", Value::Number(timestamp));
println!("โ
Timestamp: {}", timestamp);
}
// @now - Generate current date/time in ISO format
let now_result = xlh(&hlx,"@now", "").await;
if let Ok(Value::String(now)) = now_result {
hlx.set("basic", "now", Value::String(now.clone()));
println!("โ
Now: {}", now);
}
// Variable and Environment Access
println!("\n--- Setting Variable & Environment Operators ---");
// @var - Get/set global variables
let var_result = xlh(&hlx,"@var", "name=project_name, value=MyAwesomeProject").await;
if let Ok(Value::String(var)) = var_result {
hlx.set("variables", "project_name", Value::String(var.clone()));
println!("โ
Variable: {}", var);
}
// @env - Read environment variables
let env_result = xlh(&hlx,"@env", "var=HOME").await;
if let Ok(Value::String(home)) = env_result {
hlx.set("environment", "home", Value::String(home.clone()));
println!("โ
Home directory: {}", home);
}
// @exec - Execute shell commands
let exec_result = xlh(&hlx,"@exec", "command=git rev-parse HEAD 2>/dev/null || echo 'no-commit'").await;
if let Ok(Value::Object(obj)) = exec_result {
if let Some(Value::String(stdout)) = obj.get("stdout") {
if stdout != "no-commit" {
hlx.set("git", "commit", Value::String(stdout.clone()));
println!("โ
Git commit: {}", stdout);
}
}
}
// Math and Calculations
println!("\n--- Setting Math Operators ---");
// @math - Mathematical operations
let math_result = xlh(&hlx,"@math", "operation=add, a=5, b=3").await;
if let Ok(Value::Number(result)) = math_result {
hlx.set("math", "add_5_3", Value::Number(result));
println!("โ
Math (5+3): {}", result);
}
// @calc - Expression evaluation
let calc_result = xlh(&hlx,"@calc", "expression=5+3").await;
if let Ok(Value::Number(result)) = calc_result {
hlx.set("math", "calc_5_3", Value::Number(result));
println!("โ
Calc (5+3): {}", result);
}
// @min - Find minimum value
let min_result = xlh(&hlx,"@min", "{\"values\":[1,2,3,4,5]}").await;
if let Ok(Value::Object(obj)) = min_result {
if let Some(Value::Number(result)) = obj.get("min") {
hlx.set("math", "min_1_to_5", Value::Number(*result));
println!("โ
Min (1,2,3,4,5): {}", result);
}
}
// @max - Find maximum value
let max_result = xlh(&hlx,"@max", "{\"values\":[1,2,3,4,5]}").await;
match max_result {
Ok(Value::Object(obj)) => {
if let Some(Value::Number(result)) = obj.get("max") {
hlx.set("math", "max_1_to_5", Value::Number(*result));
println!("โ
Max (1,2,3,4,5): {}", result);
}
}
Ok(value) => println!("โ Max: Unexpected type: {:?}", value),
Err(e) => println!("โ Max failed: {}", e),
}
// @avg - Calculate average
let avg_result = xlh(&hlx,"@avg", "{\"values\":[1,2,3,4,5]}").await;
if let Ok(Value::Number(result)) = avg_result {
hlx.set("math", "avg_1_to_5", Value::Number(result));
println!("โ
Avg (1,2,3,4,5): {}", result);
}
// @sum - Calculate sum
let sum_result = xlh(&hlx,"@sum", "{\"values\":[1,2,3,4,5]}").await;
if let Ok(Value::Number(result)) = sum_result {
hlx.set("math", "sum_1_to_5", Value::Number(result));
println!("โ
Sum (1,2,3,4,5): {}", result);
}
// @round - Round numbers
let round_result = xlh(&hlx,"@round", "value=3.14159").await;
if let Ok(Value::Number(result)) = round_result {
hlx.set("math", "round_pi", Value::Number(result));
println!("โ
Round (3.14159): {}", result);
}
// Date and Time
println!("\n--- Setting Date & Time Operators ---");
// @date - Format dates
let date_result = xlh(&hlx,"@date", "format=%Y-%m-%d").await;
if let Ok(Value::String(result)) = date_result {
hlx.set("datetime", "date", Value::String(result.clone()));
println!("โ
Date: {}", result);
}
// @time - Format times
let time_result = xlh(&hlx,"@time", "format=%H:%M:%S").await;
if let Ok(Value::String(result)) = time_result {
hlx.set("datetime", "time", Value::String(result.clone()));
println!("โ
Time: {}", result);
}
// @format - Format values
let format_result = xlh(&hlx,"@format", "value=2024-01-01, format=%Y-%m-%d").await;
if let Ok(Value::String(result)) = format_result {
hlx.set("datetime", "formatted_date", Value::String(result.clone()));
println!("โ
Formatted Date: {}", result);
}
// @timezone - Timezone operations
let timezone_result = xlh(&hlx,"@timezone", "zone=UTC").await;
if let Ok(Value::String(result)) = timezone_result {
hlx.set("datetime", "timezone", Value::String(result.clone()));
println!("โ
Timezone: {}", result);
}
// Array and Collections
println!("\n--- Setting Array & Collection Operators ---");
// @array - Array operations
let array_result = xlh(&hlx,"@array", "{\"operation\":\"create\",\"items\":[1,2,3]}").await;
match array_result {
Ok(Value::Array(result)) => {
hlx.set("collections", "array_1_2_3", Value::Array(result));
println!("โ
Array [1,2,3]: Created");
}
Ok(value) => println!("โ Array: Unexpected type: {:?}", value),
Err(e) => println!("โ Array failed: {}", e),
}
// @map - Transform arrays
let map_result = xlh(&hlx,"@map", "{\"action\":\"transform\",\"array\":[1,2,3],\"function\":\"x*2\"}").await;
if let Ok(Value::Array(result)) = map_result {
hlx.set("collections", "mapped_array", Value::Array(result));
println!("โ
Map (x*2): Transformed");
}
// @filter - Filter arrays
let filter_result = xlh(&hlx,"@filter", "{\"action\":\"filter\",\"array\":[1,2,3,4,5],\"condition\":\"x>2\"}").await;
if let Ok(Value::Array(result)) = filter_result {
hlx.set("collections", "filtered_array", Value::Array(result));
println!("โ
Filter (x>2): Filtered");
}
// @sort - Sort arrays
let sort_result = xlh(&hlx,"@sort", "{\"action\":\"sort\",\"array\":[3,1,4,2]}").await;
if let Ok(Value::Array(result)) = sort_result {
hlx.set("collections", "sorted_array", Value::Array(result));
println!("โ
Sort: Sorted");
}
// @join - Join arrays
let join_result = xlh(&hlx,"@join", "{\"action\":\"join\",\"array\":[\"a\",\"b\",\"c\"],\"separator\":\",\"}").await;
if let Ok(Value::String(result)) = join_result {
hlx.set("collections", "joined_array", Value::String(result.clone()));
println!("โ
Join: {}", result);
}
// @split - Split strings
let split_result = xlh(&hlx,"@split", "{\"action\":\"split\",\"text\":\"a,b,c\",\"separator\":\",\"}").await;
if let Ok(Value::Array(result)) = split_result {
hlx.set("collections", "split_string", Value::Array(result));
println!("โ
Split: Split");
}
// @length - Get length
let length_result = xlh(&hlx,"@length", "{\"value\":[1,2,3,4,5]}").await;
if let Ok(Value::Number(result)) = length_result {
hlx.set("collections", "array_length", Value::Number(result));
println!("โ
Length: {}", result);
}
// Conditional and Logic
println!("\n--- Setting Conditional & Logic Operators ---");
// @if - Conditional logic
let if_result = xlh(&hlx,"@if", "condition=true, then=yes, else=no").await;
if let Ok(Value::String(result)) = if_result {
hlx.set("logic", "if_true", Value::String(result.clone()));
println!("โ
If (true): {}", result);
}
// @case - Pattern matching
let case_result = xlh(&hlx,"@case", "{\"value\":2,\"pattern\":[1,2,3]}").await;
if let Ok(Value::String(result)) = case_result {
hlx.set("logic", "case_2", Value::String(result.clone()));
println!("โ
Case (2): {}", result);
}
// @default - Default values
let default_result = xlh(&hlx,"@default", "{\"value\":\"fallback\"}").await;
if let Ok(Value::String(result)) = default_result {
hlx.set("logic", "default_value", Value::String(result.clone()));
println!("โ
Default: {}", result);
}
// @and - Logical AND
let and_result = xlh(&hlx,"@and", "{\"values\":[true,true,false]}").await;
if let Ok(Value::Bool(result)) = and_result {
hlx.set("logic", "and_true_true_false", Value::Bool(result));
println!("โ
And (true,true,false): {}", result);
}
// @or - Logical OR
let or_result = xlh(&hlx,"@or", "{\"values\":[false,false,true]}").await;
if let Ok(Value::Bool(result)) = or_result {
hlx.set("logic", "or_false_false_true", Value::Bool(result));
println!("โ
Or (false,false,true): {}", result);
}
// @not - Logical NOT
let not_result = xlh(&hlx,"@not", "{\"value\":true}").await;
if let Ok(Value::Bool(result)) = not_result {
hlx.set("logic", "not_true", Value::Bool(result));
println!("โ
Not (true): {}", result);
}
// HTTP and Request Data
println!("\n--- Setting HTTP & Request Operators ---");
// @session - Session data
let session_result = xlh(&hlx,"@session", "{\"action\":\"get\",\"key\":\"user_id\"}").await;
if let Ok(Value::String(result)) = session_result {
hlx.set("http", "session_user_id", Value::String(result.clone()));
println!("โ
Session: {}", result);
}
// @cookie - Cookie data
let cookie_result = xlh(&hlx,"@cookie", "{\"action\":\"get\",\"name\":\"session\"}").await;
if let Ok(Value::String(result)) = cookie_result {
hlx.set("http", "cookie_session", Value::String(result.clone()));
println!("โ
Cookie: {}", result);
}
// @param - URL parameters
let param_result = xlh(&hlx,"@param", "{\"action\":\"get\",\"name\":\"id\"}").await;
if let Ok(Value::String(result)) = param_result {
hlx.set("http", "param_id", Value::String(result.clone()));
println!("โ
Param: {}", result);
}
// @query - Query parameters
let query_result = xlh(&hlx,"@query", "{\"action\":\"get\",\"name\":\"search\"}").await;
if let Ok(Value::String(result)) = query_result {
hlx.set("http", "query_search", Value::String(result.clone()));
println!("โ
Query: {}", result);
}
// String Processing
println!("\n--- Setting String Processing Operators ---");
// @string - String transformations
let string_result = xlh(&hlx,"@string", "{\"input\":\"hello\",\"operation\":\"upper\"}").await;
if let Ok(Value::String(result)) = string_result {
hlx.set("strings", "hello_upper", Value::String(result.clone()));
println!("โ
String (hello->upper): {}", result);
}
// Data Encoding/Decoding
println!("\n--- Setting Data Encoding/Decoding Operators ---");
// @base64 - Base64 encoding/decoding
let base64_result = xlh(&hlx,"@base64", "{\"input\":\"hello\",\"operation\":\"encode\"}").await;
if let Ok(Value::String(result)) = base64_result {
hlx.set("encoding", "base64_hello", Value::String(result.clone()));
println!("โ
Base64 (hello->encode): {}", result);
}
// @hash - Hashing operations
let hash_result = xlh(&hlx,"@hash", "{\"input\":\"hello\",\"algorithm\":\"sha256\"}").await;
if let Ok(Value::String(result)) = hash_result {
hlx.set("encoding", "hash_hello_sha256", Value::String(result.clone()));
println!("โ
Hash (hello->sha256): {}", result);
}
// @json - JSON operations
let json_result = xlh(&hlx,"@json", "{\"input\":\"{\\\"key\\\":\\\"value\\\"}\",\"operation\":\"parse\"}").await;
if let Ok(Value::Object(result)) = json_result {
hlx.set("encoding", "json_parsed", Value::Object(result));
println!("โ
JSON: Parsed");
}
// @url - URL encoding/decoding
let url_result = xlh(&hlx,"@url", "{\"input\":\"https://example.com\",\"operation\":\"encode\"}").await;
if let Ok(Value::String(result)) = url_result {
hlx.set("encoding", "url_encoded", Value::String(result.clone()));
println!("โ
URL (encode): {}", result);
}
// Switch operations
println!("\n--- Setting Switch Operations ---");
// @switch - Switch/case operations
let switch_result = xlh(&hlx,"@switch", "{\"value\":2,\"cases\":[{\"match\":1,\"result\":\"one\"},{\"match\":2,\"result\":\"two\"}]}").await;
if let Ok(Value::String(result)) = switch_result {
hlx.set("control", "switch_2", Value::String(result.clone()));
println!("โ
Switch (2): {}", result);
}
hlx.file_path = Some(std::path::PathBuf::from("all-ops.hlx"));
hlx.save()?;
println!("โ
Saved to all-ops.hlx");
println!("\n=== HLX Set All Operators Example Complete ===");
Ok(())
}
Get All Values Example
//! HLX Get All Values Example
use helix::{Hlx, DnaValue as Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("=== HLX Get All Values Example ===");
let mut hlx = Hlx::load("all-ops.hlx").await?;
if let Some(Value::String(now)) = hlx.get("basic", "now") {
println!("โ
Now: {}", now);
} else {
println!("โ Now: Not found");
}
// Variable and Environment Access
println!("\n--- Getting Variable & Environment Operators ---");
if let Some(Value::String(var)) = hlx.get("variables", "project_name") {
println!("โ
Variable: {}", var);
} else {
println!("โ Variable: Not found");
}
if let Some(Value::String(home)) = hlx.get("environment", "home") {
println!("โ
Home directory: {}", home);
} else {
println!("โ Home directory: Not found");
}
// Math and Calculations
println!("\n--- Getting Math Operators ---");
if let Some(Value::Number(result)) = hlx.get("math", "add_5_3") {
println!("โ
Math (5+3): {}", result);
} else {
println!("โ Math (5+3): Not found");
}
if let Some(Value::Number(result)) = hlx.get("math", "calc_5_3") {
println!("โ
Calc (5+3): {}", result);
} else {
println!("โ Calc (5+3): Not found");
}
if let Some(Value::Number(result)) = hlx.get("math", "min_1_to_5") {
println!("โ
Min (1,2,3,4,5): {}", result);
} else {
println!("โ Min (1,2,3,4,5): Not found");
}
if let Some(Value::Number(result)) = hlx.get("math", "max_1_to_5") {
println!("โ
Max (1,2,3,4,5): {}", result);
} else {
println!("โ Max (1,2,3,4,5): Not found");
}
if let Some(Value::Number(result)) = hlx.get("math", "avg_1_to_5") {
println!("โ
Avg (1,2,3,4,5): {}", result);
} else {
println!("โ Avg (1,2,3,4,5): Not found");
}
if let Some(Value::Number(result)) = hlx.get("math", "sum_1_to_5") {
println!("โ
Sum (1,2,3,4,5): {}", result);
} else {
println!("โ Sum (1,2,3,4,5): Not found");
}
if let Some(Value::Number(result)) = hlx.get("math", "round_pi") {
println!("โ
Round (3.14159): {}", result);
} else {
println!("โ Round (3.14159): Not found");
}
// Date and Time
println!("\n--- Getting Date & Time Operators ---");
if let Some(Value::String(result)) = hlx.get("datetime", "date") {
println!("โ
Date: {}", result);
} else {
println!("โ Date: Not found");
}
if let Some(Value::String(result)) = hlx.get("datetime", "time") {
println!("โ
Time: {}", result);
} else {
println!("โ Time: Not found");
}
if let Some(Value::String(result)) = hlx.get("datetime", "formatted_date") {
println!("โ
Formatted Date: {}", result);
} else {
println!("โ Formatted Date: Not found");
}
if let Some(Value::String(result)) = hlx.get("datetime", "timezone") {
println!("โ
Timezone: {}", result);
} else {
println!("โ Timezone: Not found");
}
// Array and Collections
println!("\n--- Getting Array & Collection Operators ---");
if let Some(Value::Array(result)) = hlx.get("collections", "array_1_2_3") {
println!("โ
Array [1,2,3]: {:?}", result);
} else {
println!("โ Array [1,2,3]: Not found");
}
if let Some(Value::Array(result)) = hlx.get("collections", "mapped_array") {
println!("โ
Mapped Array: {:?}", result);
} else {
println!("โ Mapped Array: Not found");
}
if let Some(Value::Array(result)) = hlx.get("collections", "filtered_array") {
println!("โ
Filtered Array: {:?}", result);
} else {
println!("โ Filtered Array: Not found");
}
if let Some(Value::Array(result)) = hlx.get("collections", "sorted_array") {
println!("โ
Sorted Array: {:?}", result);
} else {
println!("โ Sorted Array: Not found");
}
if let Some(Value::String(result)) = hlx.get("collections", "joined_array") {
println!("โ
Joined Array: {}", result);
} else {
println!("โ Joined Array: Not found");
}
if let Some(Value::Array(result)) = hlx.get("collections", "split_string") {
println!("โ
Split String: {:?}", result);
} else {
println!("โ Split String: Not found");
}
if let Some(Value::Number(result)) = hlx.get("collections", "array_length") {
println!("โ
Array Length: {}", result);
} else {
println!("โ Array Length: Not found");
}
// Conditional and Logic
println!("\n--- Getting Conditional & Logic Operators ---");
if let Some(Value::String(result)) = hlx.get("logic", "if_true") {
println!("โ
If (true): {}", result);
} else {
println!("โ If (true): Not found");
}
if let Some(Value::String(result)) = hlx.get("logic", "case_2") {
println!("โ
Case (2): {}", result);
} else {
println!("โ Case (2): Not found");
}
if let Some(Value::String(result)) = hlx.get("logic", "default_value") {
println!("โ
Default: {}", result);
} else {
println!("โ Default: Not found");
}
if let Some(Value::Bool(result)) = hlx.get("logic", "and_true_true_false") {
println!("โ
And (true,true,false): {}", result);
} else {
println!("โ And (true,true,false): Not found");
}
if let Some(Value::Bool(result)) = hlx.get("logic", "or_false_false_true") {
println!("โ
Or (false,false,true): {}", result);
} else {
println!("โ Or (false,false,true): Not found");
}
if let Some(Value::Bool(result)) = hlx.get("logic", "not_true") {
println!("โ
Not (true): {}", result);
} else {
println!("โ Not (true): Not found");
}
// HTTP and Request Data
println!("\n--- Getting HTTP & Request Operators ---");
if let Some(Value::String(result)) = hlx.get("http", "session_user_id") {
println!("โ
Session: {}", result);
} else {
println!("โ Session: Not found");
}
if let Some(Value::String(result)) = hlx.get("http", "cookie_session") {
println!("โ
Cookie: {}", result);
} else {
println!("โ Cookie: Not found");
}
if let Some(Value::String(result)) = hlx.get("http", "param_id") {
println!("โ
Param: {}", result);
} else {
println!("โ Param: Not found");
}
if let Some(Value::String(result)) = hlx.get("http", "query_search") {
println!("โ
Query: {}", result);
} else {
println!("โ Query: Not found");
}
// String Processing
println!("\n--- Getting String Processing Operators ---");
if let Some(Value::String(result)) = hlx.get("strings", "hello_upper") {
println!("โ
String (hello->upper): {}", result);
} else {
println!("โ String (hello->upper): Not found");
}
// Data Encoding/Decoding
println!("\n--- Getting Data Encoding/Decoding Operators ---");
if let Some(Value::String(result)) = hlx.get("encoding", "base64_hello") {
println!("โ
Base64 (hello->encode): {}", result);
} else {
println!("โ Base64 (hello->encode): Not found");
}
if let Some(Value::String(result)) = hlx.get("encoding", "hash_hello_sha256") {
println!("โ
Hash (hello->sha256): {}", result);
} else {
println!("โ Hash (hello->sha256): Not found");
}
if let Some(Value::Object(result)) = hlx.get("encoding", "json_parsed") {
println!("โ
JSON Parsed: {:?}", result);
} else {
println!("โ JSON Parsed: Not found");
}
if let Some(Value::String(result)) = hlx.get("encoding", "url_encoded") {
println!("โ
URL (encode): {}", result);
} else {
println!("โ URL (encode): Not found");
}
// Switch operations
println!("\n--- Getting Switch Operations ---");
if let Some(Value::String(result)) = hlx.get("control", "switch_2") {
println!("โ
Switch (2): {}", result);
} else {
println!("โ Switch (2): Not found");
}
// Display all sections and keys
println!("\n--- All Available Sections and Keys ---");
for (section_name, section_data) in &hlx.data {
println!("\n๐ Section: {}", section_name);
for (key_name, value) in section_data {
match value {
Value::String(s) => println!(" ๐ค {} = \"{}\"", key_name, s),
Value::Number(n) => println!(" ๐ข {} = {}", key_name, n),
Value::Bool(b) => println!(" โ
{} = {}", key_name, b),
Value::Array(arr) => println!(" ๐ {} = {:?}", key_name, arr),
Value::Object(obj) => println!(" ๐ฆ {} = {:?}", key_name, obj),
Value::Null => println!(" โ {} = null", key_name),
Value::Duration(d) => println!(" โฑ๏ธ {} = {:?}", key_name, d),
Value::Reference(r) => println!(" ๐ {} = @{}", key_name, r),
Value::Identifier(i) => println!(" ๐ท๏ธ {} = {}", key_name, i),
}
}
}
// Generate updated HLX content
println!("\n--- Generating Updated HLX Content ---");
let content = hlx.make()?;
// Save to get-all-results.hlx
std::fs::write("get-all-results.hlx", &content)?;
println!("โ
Saved to get-all-results.hlx");
// Display the content
println!("\n--- Generated HLX Content ---");
println!("{}", content);
println!("\n=== HLX Get All Values Example Complete ===");
Ok(())
}
๐จ Real-World Examples
Configuration Management
project "WebService" :
name = "HLX API Server"
version = "1.1.9"
port = @env var=PORT default=8080
database_url = @base64 input=postgresql://user:pass@localhost/db operation=encode
api_key_hash = @hash input=my-secret-key algorithm=sha256
startup_time = @timestamp
instance_id = @uuid
;
agent "Database" :
name = "PostgreSQL Connection Pool"
max_connections = @math operation=mul a=10 b=100
timeout_ms = @math operation=mul a=30 b=1000
cache_size = @math operation=pow a=2 b=10
;
Data Processing Pipeline
workflow "DataPipeline" :
name = "ETL Processing"
input_format = "json"
output_format = "hlx"
# Process incoming data
processed_data = @json input={"name":"John","age":30} operation=parse
name_upper = @string input=John operation=upper
age_hash = @hash input=30 algorithm=md5
# Generate output
output_id = @uuid
processed_at = @now
data_hash = @hash input={"name":"JOHN","age":"30"} algorithm=sha256
;
Counter & Statistics Management
context "Analytics" :
# Initialize counters
page_views = 0
user_registrations = 0
api_calls = 0
# Increment counters (via hlx.increase())
# page_views = 1, 2, 3...
# user_registrations = 1, 2, 3...
# api_calls = 100, 150, 200...
;
context "Session" :
# Track session metrics
duration_minutes = 0.0
interactions = 0
errors = 0
# Increment session data
# duration_minutes = 15.5, 23.75...
# interactions = 1, 2, 3...
;
Security & Validation
context "Security" :
# Hash sensitive data
password_hash = @hash input=user_password algorithm=sha256
api_key_encoded = @base64 input=secret_api_key operation=encode
# Validate input
is_valid_email = @string input=user@example.com operation=length
sanitized_input = @string input=user_input operation=trim
# Generate secure tokens
session_token = @uuid
csrf_token = @hash input=session_data algorithm=sha256
timestamp = @timestamp
;
๐ ๏ธ Installation
From Source
git clone https://github.com/helix/hlx.git
cd hlx
cargo build --release
Add to Your Project
[dependencies]
hlx = { path = "../hlx" }
tokio = { version = "1.0", features = ["full"] }
๐ Documentation
Operator Reference
Examples
- Basic Usage
- Increase Method
- All Operators Demo - Demonstrates all 38 operators
- Operator Examples
- Advanced Patterns
๐ฏ Key Features
โ What HLX Does Well
- 38 Working Operators - Comprehensive data processing capabilities
- Increase Method - Built-in counter increment functionality
- Type Safety - Rust's type system ensures reliability
- Async Support - Built for modern async/await patterns
- Extensible - Easy to add custom operators
- Fast - Rust performance with zero-cost abstractions
- Memory Safe - No garbage collection overhead
- Cross-Platform - Works on Linux, macOS, Windows
๐ง Operator Categories
- Basic: UUID, timestamps, current time
- Data: Base64, JSON, URL encoding/decoding
- Security: SHA256/MD5 hashing, data integrity
- Math: Arithmetic, statistical functions
- String: Transform, analyze, extract text
- Logic: Conditional operations, pattern matching
- Web: Session, cookie, HTTP context
- Variables: Global state, environment access
๐ Performance
HLX is built for performance:
- Zero-cost abstractions - Operator calls compile to efficient code
- Memory efficient - No garbage collection, predictable memory usage
- Fast execution - Rust's performance with async support
- Scalable - Handles large configurations and data processing
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Development Setup
git clone https://github.com/helix/hlx.git
cd hlx
cargo test
cargo run --example basic_set_get
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built with โค๏ธ using Rust
- Inspired by modern configuration management needs
- Designed for developer happiness and system reliability
HLX - Where Configuration Meets Power ๐
Transform your configuration files into powerful data processing pipelines with HLX's beautiful operator system.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file helix_hlx-1.1.7.tar.gz.
File metadata
- Download URL: helix_hlx-1.1.7.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34ad972a3555cbb46c56747b0de55e343cab9837b648f0d50db1b74e6e1a773d
|
|
| MD5 |
45465bfc7c6b40f58c9fc1ee932acf92
|
|
| BLAKE2b-256 |
920f953ca556b779d31841072bc15509347284ad5bfe943b560bbdd23ccc989c
|