10000 GitHub - ldaniels528/oxide: Oxide is a hybrid database and streaming messaging system (think Kafka + MySQL); supporting data access via REST and SQL.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Oxide is a hybrid database and streaming messaging system (think Kafka + MySQL); supporting data access via REST and SQL.

License

Notifications You must be signed in to change notification settings

ldaniels528/oxide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧪 Oxide — A Lightweight, Modern Language for Data, APIs & Automation

Oxide is a clean, expressive scripting language built for the modern developer. Whether you're transforming data, automating workflows, building APIs, or exploring time-based events, Oxide empowers you with elegant syntax and a practical standard library—designed to make complex operations feel intuitive.


Table of Contents


🚀 Why Choose Oxide?

Clean, Functional Syntax

Write less, do more. Concise expressions, intuitive chaining, and minimal boilerplate make Oxide a joy to use.

🧰 Batteries Included

Built-in modules like cal, io, math, str, www, and more cover the essentials—without reaching for external libraries.

🔗 Composable Pipelines

Use ::: to build seamless transformation pipelines—perfect for chaining, mapping, filtering, and data shaping.

🌐 Web-Native by Design

Call an API, parse the response, and persist results—in a single line of code.

🧠 Human-Centered

Inspired by functional programming, Oxide is readable, predictable, and powerful enough for real-world use without excess noise.


🧰 What Can You Do with Oxide?

🌍 Call APIs and Handle Responses

GET https://api.example.com/users

🧮 Transform Arrays and Maps

use arrays
users = [ { name: 'Tom' }, { name: 'Sara' } ]
names = users:::map(u -> u::name)

🕒 Work with Dates and Durations

use cal, durations
cal::plus(now(), 30:::days())

🔄 Compose Data Pipelines

use arrays
let arr = [1, 2, 3, 4]
arr:::filter(x -> (x % 2) == 0):::map(x -> x * 10)

👥 Who Is Oxide For?

  • Data Engineers & Analysts — quick scripting for time and table-based operations.
  • Web Developers — seamless API interactions and response transformations.
  • Scripters & Hackers — ideal for automation, file operations, and glue code.
  • Language Enthusiasts — a functional-style pipeline DSL with just enough structure.

🛠️ Getting Started

🔧 Build the REPL & Server

cargo build --release

Artifacts will be in ./target/release/:

  • oxide – Oxide REPL / Server

✅ Run the Tests

cargo test

🔬 Over 800 tests (and counting) ensure Oxide's reliability and edge-case coverage.


📦 Core language & Platform

The remainder of this document showcases categorized usage examples across Oxide's standard modules including:

  • arrays, cal, durations, io, math, os, oxide, str, tools, util, and www.

To improve navigation, consider splitting the examples into separate markdown files or auto-generating docs from code annotations using a tool like mdBook, Docusaurus, or a custom Rust doc generator.

🧮 Binary Operators Reference

Oxide provides a rich set of binary operators for arithmetic, logic, assignment, comparison, bitwise manipulation, and expressive data flow. This document summarizes the available operators and their intended semantics.


🔢 Arithmetic Operators

Operator Meaning
+ Addition
++ Concatenation or Join
- Subtraction
*, × Multiplication
/, ÷ Division
% Modulo
** Power (Exponentiation)

🧠 Assignment Operators

Operator Meaning
= Assign variable
+= Add and assign
-= Subtract and assign
*= Multiply and assign
/= Divide and assign
%= Modulo and assign
&= Bitwise AND and assign
⎜= Bitwise OR and assign
^= Bitwise XOR and assign
?= Coalesce and assign
&&= Logical AND and assign
⎜⎜= Logical OR and assign
:= Declare and assign expression

🧮 Bitwise Operators

Operator Meaning
& Bitwise AND
Bitwise OR
^ Bitwise XOR
<< Shift Left
>> Shift Right

🔍 Comparison and Logical Operators

Operator Meaning
==, is Equal
!=, isnt Not Equal
> Greater Than
>= Greater Than or Equal
< Less Than
<= Less Than or Equal
in Value is in Range or Set
like SQL-style pattern match
matches Regular Expression match
&& Logical AND
⎜⎜ Logical OR
? Null⎜Undefined Coalescing

🧪 Special Operators

Operator Meaning / Use Case
: Alias (value name alias)
:: Namespacing or qualified access
::: Extended namespacing or chaining
<~ Curvy arrow (left)
~> Curvy arrow (right)
-> Function application
.. Exclusive Range (a..b)
..= Inclusive Range (a..=b)

🔀 Data Flow & Piping

Operator Meaning / Use Case
⎜> Pipe Forward (`val
⎜>> Double Pipe Forward (custom logic)

📖 Core Language Examples


▶️ Aliases

example¹
name: 'Tom'
results
"Tom"
example²
tools::to_table({ name: 'Tom' })
results
|-----------|
| id | name |
|-----------|
| 0  | Tom  |
|-----------|

▶️ Arrays

example¹
// Arrays can be defined via ranges

1..7

results
[1, 2, 3, 4, 5, 6]
example²
// Arrays can be created using literals

[1, 4, 2, 8, 5, 7]

results
[1, 4, 2, 8, 5, 7]
example³
// Arrays may be destructured to assign multiple variables

let [a, b, c] = [3, 5, 7] a + b + c

results
15
example⁴
// Arrays can be transformed via the 'arrays' package

arrays::reverse([1, 4, 2, 8, 5, 7])

results
[7, 5, 8, 2, 4, 1]

▶️ Arrays: Indexing

example¹
let arr = [1, 4, 2, 8, 5, 7]
arr[3]
results
8

▶️ Assignment (expression)

example¹
// Use ":=" to simultaneously assign a value and return the assigned value

let i = 0 while (i < 5) yield (i := i + 1) * 3

results
[3, 6, 9, 12, 15]

▶️ Assignment (statement)

example¹
let a = 3
let b = 5
let c = 7
a + b + c
results
15

▶️ Bitwise And

example¹
0b1111 & 0b0101
results
5

▶️ Bitwise Or

example¹
0b1010 | 0b0101
results
15

▶️ Bitwise Shift-Left

example¹
20 << 3
results
160

▶️ Bitwise Shift-Right

example¹
20 >> 3
results
2

▶️ Bitwise XOR

example¹
0b1111 ^ 0b0101
results
10

▶️ Coalesce

example¹
"Hello" ? "it was null or undefined"
results
"Hello"
example²
null ? "it was null or undefined"
results
"it was null or undefined"
example³
undefined ? "it was null or undefined"
results
"it was null or undefined"

▶️ Coalesce Error

example¹
"No problem" !? "An error occurred"
results
"No problem"
example²
(throw "Boom!") !? "An error occurred"
results
"An error occurred"

▶️ Code Block

example¹
result = {
    let (a, b) = (5, 9)
    a + b
}
result
results
14

▶️ Conditionals

example¹
let x = 10
x in 5..=10
results
true
example²
let x = 10
x in 5..10
results
false
example³
let x = 1..8
x contains 7
results
true

▶️ Curvy-Arrow Left

example¹
stocks = nsd::save(
   "expressions.read_next_row.stocks",
   Table::new(symbol: String(8), exchange: String(8), history: Table(last_sale: f64, processed_time: Date))
)
rows = [{ symbol: "BIZ", exchange: "NYSE" }, { symbol: "GOTO", exchange: "OTC" }]
rows ~> stocks
// read the last row
last_row <~ stocks
last_row
results
{"exchange":"OTC","history":[],"symbol":"GOTO"}

▶️ Curvy-Arrow Right

example¹
stocks = nsd::save(
   "expressions.into.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
rows = [
   { symbol: "ABC", exchange: "AMEX", last_sale: 12.49 },
   { symbol: "BOOM", exchange: "NYSE", last_sale: 56.88 },
   { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 }
]
rows ~> stocks
results
3

▶️ Do-While expression

example¹
let i = 0
do {
    i = i + 1
    yield i * 2
} while (i < 5)
results
[2, 4, 6, 8, 10]

▶️ Function Pipelines (destructuring)

example¹
use tools::reverse
result = 'Hello' |> reverse
result
results
"olleH"
example²
// arrays, tuples and structures can be deconstructed into arguments

fn add(a, b) -> a + b fn inverse(a) -> 1.0 / a result = (2, 3) |>> add |> inverse result

results
0.2

▶️ HTTP

example¹
stocks = nsd::save(
   "readme.www.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
www::serve(8855)
results
true
example²
POST {
    url: http://localhost:8855/readme/www/stocks/0
    body: { symbol: "ABC", exchange: "AMEX", last_sale: 11.77 }
}
results
0
example³
GET http://localhost:8855/readme/www/stocks/0
results
{exchange: "AMEX", last_sale: 11.77, symbol: "ABC"}
example⁴
HEAD http://localhost:8855/readme/www/stocks/0
results
{content-length: "80", content-type: "application/json", date: "Sun, 15 Jun 2025 01:45:57 GMT"}
example⁵
PUT {
    url: http://localhost:8855/readme/www/stocks/0
    body: { symbol: "ABC", exchange: "AMEX", last_sale: 11.79 }
}
results
1
example⁶
GET http://localhost:8855/readme/www/stocks/0
results
{exchange: "AMEX", last_sale: 11.79, symbol: "ABC"}
example⁷
PATCH {
    url: http://localhost:8855/readme/www/stocks/0
    body: { last_sale: 11.81 }
}
results
1
example⁸
GET http://localhost:8855/readme/www/stocks/0
results
{exchange: "AMEX", last_sale: 11.81, symbol: "ABC"}
example⁹
DELETE http://localhost:8855/readme/www/stocks/0
results
1
example¹⁰
GET http://localhost:8855/readme/www/stocks/0
results
{}

▶️ IF expression

example¹
// Oxide provides an if-else statement

let x = 4 if(x > 5) "Yes" else if(x < 5) "Maybe" else "No"

results
"Maybe"
example²
// Oxide also provides if - a ternary-operator-like if function

fact = n -> if(n <= 1, 1, n * fact(n - 1)) fact(6)

results
720

▶️ Implicit Method Call

example¹
use durations
8:::hours()
results
28800000

▶️ Import/Use

example¹
use tools
stocks = to_table([
   { symbol: "ABC", exchange: "AMEX", last_sale: 12.49 },
   { symbol: "BOOM", exchange: "NYSE", last_sale: 56.88 },
   { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 }
])
stocks
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 0  | ABC    | AMEX     | 12.49     |
| 1  | BOOM   | NYSE     | 56.88     |
| 2  | JET    | NASDAQ   | 32.12     |
|------------------------------------|

▶️ Infix

example¹
let stock = { symbol: "TED", exchange: "AMEX", last_sale: 13.37 }
stock.last_sale
results
13.37

▶️ Iteration

example¹
for row in tools::to_table(['apple', 'berry', 'kiwi', 'lime']) 
    yield row::value
results
["apple", "berry", "kiwi", "lime"]

▶️ Match expression

example¹
let code = 100
match code {
   100 => "Accepted"
   n when n in 101..=104 => "Escalated"
   n when n < 100 => "Pending"
   n => "Rejected"
}
results
"Accepted"
example²
let code = 101
match code {
   100 => "Accepted"
   n when n in 101..=104 => "Escalated"
   n when n < 100 => "Pending"
   n => "Rejected"
}
results
"Escalated"
example³
let code = 99
match code {
   100 => "Accepted"
   n when n in 101..=104 => "Escalated"
   n when n < 100 => "Pending"
   n => "Rejected"
}
results
"Pending"
example⁴
let code = 110
match code {
   100 => "Accepted"
   n when n in 101..=104 => "Escalated"
   n when n < 100 => "Pending"
   n => "Rejected"
}
results
"Rejected"

▶️ Mathematics: addition

example¹
5 + 6
results
11

▶️ Mathematics: division

example¹
20.0 / 3
results
6.666666666666667

▶️ Mathematics: multiplication

example¹
5 * 6
results
30

▶️ Mathematics: subtraction

example¹
188 - 36
results
152

▶️ Method Call

example¹
tools::to_table([
    'apple', 'berry', 'kiwi', 'lime'
])
results
|------------|
| id | value |
|------------|
| 0  | apple |
| 1  | berry |
| 2  | kiwi  |
| 3  | lime  |
|------------|

▶️ Negative

example¹
let i = 75
let j = -i
j
results
-75

▶️ Ranges

example¹
// Ranges may be exclusive

range = 1..5 tools::reverse(range)

results
[4, 3, 2, 1]
example²
// Ranges may be inclusive

range = 1..=5 tools::reverse(range)

results
[5, 4, 3, 2, 1]

▶️ Testing

example¹
Feature "Matches function" {
    Scenario "Compare Array contents: Equal" {
        assert(
            [ 1 "a" "b" "c" ] matches [ 1 "a" "b" "c" ]
        )
    }
    Scenario "Compare Array contents: Not Equal" {
        assert(!(
            [ 1 "a" "b" "c" ] matches [ 0 "x" "y" "z" ]
        ))
    }
    Scenario "Compare JSON contents (in sequence)" {
        assert(
           { first: "Tom" last: "Lane" } matches { first: "Tom" last: "Lane" }
        )
    }
    Scenario "Compare JSON contents (out of sequence)" {
        assert(
           { scores: [82 78 99], id: "A1537" } 
                       matches 
           { id: "A1537", scores: [82 78 99] }
        )
    }
}
results
|------------------------------------------------------------------------------------------------------------------------|
| id | level | item                                                                                    | passed | result |
|------------------------------------------------------------------------------------------------------------------------|
| 0  | 0     | Matches function                                                                        | true   | true   |
| 1  | 1     | Compare Array contents: Equal                                                           | true   | true   |
| 2  | 2     | assert [1, "a", "b", "c"] matches [1, "a", "b", "c"]                                    | true   | true   |
| 3  | 1     | Compare Array contents: Not Equal                                                       | true   | true   |
| 4  | 2     | assert !([1, "a", "b", "c"] matches [0, "x", "y", "z"])                                 | true   | true   |
| 5  | 1     | Compare JSON contents (in sequence)                                                     | true   | true   |
| 6  | 2     | assert {first: "Tom", last: "Lane"} matches {first: "Tom", last: "Lane"}                | true   | true   |
| 7  | 1     | Compare JSON contents (out of sequence)                                                 | true   | true   |
| 8  | 2     | assert {scores: [82, 78, 99], id: "A1537"} matches {id: "A1537", scores: [82, 78, 99]}  | true   | true   |
|------------------------------------------------------------------------------------------------------------------------|

▶️ Throw

example¹
throw("this is an error")
results
this is an error

▶️ Tuples

example¹
// Tuples may be destructured to assign multiple variables

(a, b, c) = (3, 5, 7) a + b + c

results
15
example²
// Tuples support addition

let a = (2, 4, 6) let b = (1, 2, 3) a + b

results
(3, 6, 9)
example³
// Tuples support subtraction

let a = (3, 5, 7) let b = (1, 0, 1) a - b

results
(2, 5, 6)
example⁴
// Tuples support negation

-(3, 6, 9)

results
(-3, -6, -9)
example⁵
// Tuples support multiplication

let a = (3, 5, 7) let b = (1, 0, 1) a * b

results
(3, 0, 7)
example⁶
// Tuples support division

let a = (3.0, 5.0, 9.0) let b = (1.0, 2.0, 1.0) a / b

results
(3, 2.5, 9)
example⁷
// Tuples support modulus

let a = (3.0, 5.0, 9.0) let b = (1.0, 2.0, 1.0) a % b

results
(0.0, 1, 0.0)
example⁸
// Tuples support exponents

let a = (2, 4, 6) let b = (1, 2, 3) a ** b

results
(2, 16, 216)

▶️ Type Definitions

example¹
LabelString = typedef(String(80))
LabelString
results
String(80)

▶️ When statement

example¹
// Executes the block at the moment the condition becomes true.
let (x, y) = (1, 0)
whenever x == 0 {
    x = x + 1
    y = y + 1
}
x = x - 1
x + y
results
2
example²
// The block will not be executed if the condition is already true.
let (x, y) = (1, 0)
whenever x == 0 || y == 0 {
    x = x + 1
    y = y + 1
}
x + y
results
1
example³
// The block will be executed after the second assignment.
let (x, y) = (1, 0)
whenever x == 0 || y == 0 {
    x = x + 1
    y = y + 1
}
let (x, y) = (2, 3)
x + y
results
5

▶️ While expression

example¹
let x = 0
while (x < 5) {
    x = x + 1
    yield x * 2
}
results
[2, 4, 6, 8, 10]

▶️ Yield

example¹
for(i = 0, i < 5, i = i + 1) yield i * 2
results
[0, 2, 4, 6, 8]

📦 Platform Examples


📦 arrays::filter — Filters an array based on a function

example1
arrays::filter(1..7, n -> (n % 2) == 0)
results
[2, 4, 6]

📦 arrays::len — Returns the length of an array

example1
arrays::len([1, 5, 2, 4, 6, 0])
results
6

📦 arrays::map — Transform an array based on a function

example1
arrays::map([1, 2, 3], n -> n * 2)
results
[2, 4, 6]

📦 arrays::pop — Removes and returns a value or object from an array

example1
use arrays
stocks = []
stocks:::push({ symbol: "ABC", exchange: "AMEX", last_sale: 12.49 })
stocks:::push({ symbol: "BOOM", exchange: "NYSE", last_sale: 56.88 })
stocks
results
[]

📦 arrays::push — Appends a value or object to an array

example1
use arrays
stocks = [
    { symbol: "ABC", exchange: "AMEX", last_sale: 12.49 },
    { symbol: "BOOM", exchange: "NYSE", last_sale: 56.88 },
    { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 }
]
stocks:::push({ symbol: "DEX", exchange: "OTC_BB", last_sale: 0.0086 })
tools::to_table(stocks)
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 0  | ABC    | AMEX     | 12.49     |
| 1  | BOOM   | NYSE     | 56.88     |
| 2  | JET    | NASDAQ   | 32.12     |
|------------------------------------|

📦 arrays::reduce — Reduces an array to a single value

example1
arrays::reduce(1..=5, 0, (a, b) -> a + b)
results
15

📦 arrays::reduce — Reduces an array to a single value

example2
use arrays::reduce
numbers = [1, 2, 3, 4, 5]
numbers:::reduce(0, (a, b) -> a + b)
results
15

📦 arrays::reverse — Returns a reverse copy of an array

example1
arrays::reverse(['cat', 'dog', 'ferret', 'mouse'])
results
["mouse", "ferret", "dog", "cat"]

📦 arrays::to_array — Converts a collection into an array

example1
arrays::to_array(tools::to_table([
   { symbol: "BIZ", exchange: "NYSE", last_sale: 23.66 },
   { symbol: "DMX", exchange: "OTC_BB", last_sale: 1.17 }
]))
results
[{"exchange":"NYSE","last_sale":23.66,"symbol":"BIZ"}, {"exchange":"NYSE","last_sale":23.66,"symbol":"BIZ"}]

📦 cal::day_of — Returns the day of the month of a Date

example1
use cal
now():::day_of()
results
14

📦 cal::hour12 — Returns the hour of the day of a Date

example1
use cal
now():::hour12()
results
6

📦 cal::hour24 — Returns the hour (military time) of the day of a Date

example1
use cal
now():::hour24()
results
18

📦 cal::minute_of — Returns the minute of the hour of a Date

example1
use cal
now():::minute_of()
results
46

📦 cal::month_of — Returns the month of the year of a Date

example1
use cal
now():::month_of()
results
6

📦 cal::second_of — Returns the seconds of the minute of a Date

example1
use cal
now():::second_of()
results
0

📦 cal::year_of — Returns the year of a Date

example1
use cal
now():::year_of()
results
2025

📦 cal::minus — Subtracts a duration from a date

example1
use cal, durations
cal::minus(now(), 3:::days())
results
1969-12-29T00:00:00.000Z

📦 cal::now — Returns the current local date and time

example1
cal::now()
results
2025-06-15T01:46:00.219Z

📦 cal::plus — Adds a duration to a date

example1
use cal, durations
cal::plus(now(), 30:::days())
results
1970-01-31T00:00:00.000Z

📦 durations::days — Converts a number into the equivalent number of days

example1
use durations
3:::days()
results
259200000

📦 durations::hours — Converts a number into the equivalent number of hours

example1
use durations
8:::hours()
results
28800000

📦 durations::millis — Converts a number into the equivalent number of millis

example1
use durations
8:::millis()
results
8

📦 durations::minutes — Converts a number into the equivalent number of minutes

example1
use durations
30:::minutes()
results
1800000

📦 durations::seconds — Converts a number into the equivalent number of seconds

example1
use durations
30:::seconds()
results
30000

📦 io::create_file — Creates a new file

example1
io::create_file("quote.json", {
   symbol: "TRX",
   exchange: "NYSE",
   last_sale: 45.32
})
results
52

📦 io::exists — Returns true if the source path exists

example1
io::exists("quote.json")
results
true

📦 io::read_text_file — Reads the contents of a text file into memory

example1
use io, util
file = "temp_secret.txt"
file:::create_file(md5("**keep**this**secret**"))
file:::read_text_file()
results
0v47338bd5f35bbb239092c36e30775b4a

📦 io::stderr — Writes a string to STDERR

example1
io::stderr("Goodbye Cruel World")
results
true

📦 io::stdout — Writes a string to STDOUT

example1
io::stdout("Hello World")
results
true

📦 math::abs — abs(x): Returns the absolute value of x.

example1
math::abs(-81)
results
81

📦 math::ceil — ceil(x): Returns the smallest integer greater than or equal to x.

example1
math::ceil(5.7)
results
6

📦 math::floor — floor(x): Returns the largest integer less than or equal to x.

example1
math::floor(5.7)
results
5

📦 math::max — max(a, b): Returns the larger of a and b

example1
math::max(81, 78)
results
81

📦 math::min — min(a, b): Returns the smaller of a and b.

example1
math::min(81, 78)
results
78

📦 math::pow — pow(x, y): Returns x raised to the power of y.

example1
math::pow(2, 3)
results
8

📦 math::round — round(x): Rounds x to the nearest integer.

example1
math::round(5.3)
results
5

📦 math::sqrt — sqrt(x): Returns the square root of x.

example1
math::sqrt(25)
results
5

📦 nsd::create_event_src — Creates a journaled event-source

example1
nsd::create_event_src(
   "examples.event_src.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
|------------------------------------|

📦 nsd::create_fn — Creates a journaled table function

example1
nsd::create_fn(
   "examples.table_fn.stocks",
   (symbol: String(8), exchange: String(8), last_sale: f64) -> {
       symbol: symbol,
       exchange: exchange,
       last_sale: last_sale * 2.0,
       event_time: cal::now()
   })
results
|-------------------------------------------------|
| id | symbol | exchange | last_sale | event_time |
|-------------------------------------------------|
|-------------------------------------------------|

📦 nsd::drop — Deletes a dataframe from a namespace

example1
nsd::save('packages.remove.stocks', Table::new(
    symbol: String(8),
    exchange: String(8),
    last_sale: f64
))

nsd::drop('packages.remove.stocks') nsd::exists('packages.remove.stocks')

results
false

📦 nsd::exists — Returns true if the source path exists

example1
nsd::save('packages.exists.stocks', Table::new(
   symbol: String(8),
   exchange: String(8),
   last_sale: f64
))
nsd::exists("packages.exists.stocks")
results
true

📦 nsd::exists — Returns true if the source path exists

example2
nsd::exists("packages.not_exists.stocks")
results
false

📦 nsd::journal — Retrieves the journal for an event-source or table function

example1
use nsd
nsd::drop("examples.journal.stocks");
stocks = nsd::create_fn(
   "examples.journal.stocks",
   (symbol: String(8), exchange: String(8), last_sale: f64) -> {
       symbol: symbol,
       exchange: exchange,
       last_sale: last_sale * 2.0,
       ingest_time: cal::now()
   });
[{ symbol: "ABC", exchange: "AMEX", last_sale: 12.49 },
 { symbol: "BOOM", exchange: "NYSE", last_sale: 56.88 },
 { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 }] ~> stocks
stocks:::journal()
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 0  | ABC    | AMEX     | 12.49     |
| 1  | BOOM   | NYSE     | 56.88     |
| 2  | JET    | NASDAQ   | 32.12     |
|------------------------------------|

📦 nsd::load — Loads a dataframe from a namespace

example1
let stocks =
   nsd::save('packages.save_load.stocks', Table::new(
       symbol: String(8),
       exchange: String(8),
       last_sale: f64
   ))

let rows = [{ symbol: "CAZ", exchange: "AMEX", last_sale: 65.13 }, { symbol: "BAL", exchange: "NYSE", last_sale: 82.78 }, { symbol: "RCE", exchange: "NASDAQ", last_sale: 124.09 }]

rows ~> stocks

nsd::load('packages.save_load.stocks')

results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 0  | CAZ    | AMEX     | 65.13     |
| 1  | BAL    | NYSE     | 82.78     |
| 2  | RCE    | NASDAQ   | 124.09    |
|------------------------------------|

📦 nsd::replay — Reconstructs the state of a journaled table

example1
use nsd
nsd::drop("examples.replay.stocks");
stocks = nsd::create_fn(
   "examples.replay.stocks",
   (symbol: String(8), exchange: String(8), last_sale: f64) -> {
       symbol: symbol,
       exchange: exchange,
       last_sale: last_sale * 2.0,
       rank: __row_id__ + 1
   });
[{ symbol: "BOOM", exchange: "NYSE", last_sale: 56.88 },
 { symbol: "ABC", exchange: "AMEX", last_sale: 12.49 },
 { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 }] ~> stocks
stocks:::replay()
results
3

📦 nsd::resize — Changes the size of a dataframe

example1
use nsd
let stocks =
   nsd::save('packages.resize.stocks', Table::new(
       symbol: String(8),
       exchange: String(8),
       last_sale: f64
   ))
[{ symbol: "TCO", exchange: "NYSE", last_sale: 38.53 },
 { symbol: "SHMN", exchange: "NYSE", last_sale: 6.57 },
 { symbol: "HMU", exchange: "NASDAQ", last_sale: 27.12 }] ~> stocks
'packages.resize.stocks':::resize(1)
stocks
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 0  | TCO    | NYSE     | 38.53     |
|------------------------------------|

📦 nsd::save — Creates a new dataframe

example1
let stocks =
   nsd::save('packages.save.stocks', Table::new(
       symbol: String(8),
       exchange: String(8),
       last_sale: f64
   ))
[{ symbol: "TCO", exchange: "NYSE", last_sale: 38.53 },
 { symbol: "SHMN", exchange: "NYSE", last_sale: 6.57 },
 { symbol: "HMU", exchange: "NASDAQ", last_sale: 27.12 }] ~> stocks
stocks
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 0  | TCO    | NYSE     | 38.53     |
| 1  | SHMN   | NYSE     | 6.57      |
| 2  | HMU    | NASDAQ   | 27.12     |
|------------------------------------|

📦 os::call — Invokes an operating system application

example1
stocks = nsd::save(
   "examples.os.call",
    Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
os::call("chmod", "777", oxide::home())
results


📦 os::clear — Clears the terminal/screen

example1
os::clear()
results
true

📦 os::current_dir — Returns the current directory

example1
use str
cur_dir = os::current_dir()
prefix = if(cur_dir:::ends_with("core"), "../..", ".")
path_str = prefix + "/demoes/language/include_file.oxide"
include path_str
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 0  | ABC    | AMEX     | 12.49     |
| 1  | BOOM   | NYSE     | 56.88     |
| 2  | JET    | NASDAQ   | 32.12     |
|------------------------------------|

📦 os::env — Returns a table of the OS environment variables

example1
os::env()
results
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| id | key                        | value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 0  | BUN_INSTALL                | /Users/ldaniels/.bun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 1  | CARGO                      | /Users/ldaniels/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo                                                                                             
10000
                                                                                                                                                                                                                                                                                                                                                                                                   |
| 2  | CARGO_HOME                 | /Users/ldaniels/.cargo                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 3  | CARGO_MANIFEST_DIR         | /Users/ldaniels/GitHub/oxide/src/core                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 4  | CARGO_MANIFEST_PATH        | /Users/ldaniels/GitHub/oxide/src/core/Cargo.toml                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 5  | CARGO_PKG_AUTHORS          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 6  | CARGO_PKG_DESCRIPTION      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 7  | CARGO_PKG_HOMEPAGE         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 8  | CARGO_PKG_LICENSE          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 9  | CARGO_PKG_LICENSE_FILE     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 10 | CARGO_PKG_NAME             | core                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 11 | CARGO_PKG_README           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 12 | CARGO_PKG_REPOSITORY       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 13 | CARGO_PKG_RUST_VERSION     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 14 | CARGO_PKG_VERSION          | 0.1.0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 15 | CARGO_PKG_VERSION_MAJOR    | 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 16 | CARGO_PKG_VERSION_MINOR    | 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 17 | CARGO_PKG_VERSION_PATCH    | 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 18 | CARGO_PKG_VERSION_PRE      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 19 | COMMAND_MODE               | unix2003                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 20 | DYLD_FALLBACK_LIBRARY_PATH | /Users/ldaniels/GitHub/oxide/target/debug/build/curl-sys-976ef1fd41b2ae67/out/build:/Users/ldaniels/GitHub/oxide/target/debug/build/libnghttp2-sys-03d0e22189823925/out/i/lib:/Users/ldaniels/GitHub/oxide/target/debug/build/zstd-sys-b2743e594d963e4d/out:/Users/ldaniels/GitHub/oxide/target/debug/deps:/Users/ldaniels/GitHub/oxide/target/debug:/Users/ldaniels/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib:/Users/ldaniels/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/ldaniels/lib:/usr/local/lib:/usr/lib |
| 21 | HOME                       | /Users/ldaniels                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 22 | JAVA_HOME                  | /Users/ldaniels/.sdkman/candidates/java/current                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 23 | LC_CTYPE                   | en_US.UTF-8                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 24 | LOGNAME                    | ldaniels                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 25 | OLDPWD                     | /                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 26 | PATH                       | /Users/ldaniels/.bun/bin:/Users/ldaniels/.sdkman/candidates/java/current/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/ldaniels/.cargo/bin:/opt/homebrew/bin:.                                                                                                                                  |
| 27 | PWD                        | /Users/ldaniels/GitHub/oxide                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 28 | RR_REAL_RUSTDOC            | /Users/ldaniels/.cargo/bin/rustdoc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 29 | RUSTC                      | /Users/ldaniels/.cargo/bin/rustc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 30 | RUSTC_BOOTSTRAP            | 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 31 | RUSTDOC                    | /Users/ldaniels/Library/Application Support/JetBrains/IntelliJIdea2025.1/plugins/intellij-rust/bin/mac/aarch64/intellij-rust-native-helper                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 32 | RUSTUP_HOME                | /Users/ldaniels/.rustup                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 33 | RUSTUP_TOOLCHAIN           | stable-aarch64-apple-darwin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 34 | RUST_BACKTRACE             | short                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 35 | RUST_RECURSION_COUNT       | 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 36 | SDKMAN_CANDIDATES_API      | https://api.sdkman.io/2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 37 | SDKMAN_CANDIDATES_DIR      | /Users/ldaniels/.sdkman/candidates                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 38 | SDKMAN_DIR                 | /Users/ldaniels/.sdkman                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 39 | SDKMAN_PLATFORM            | darwinarm64                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 40 | SHELL                      | /bin/zsh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 41 | SSH_AUTH_SOCK              | /private/tmp/com.apple.launchd.lSmiPPAhaN/Listeners                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 42 | TERM                       | ansi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 43 | TMPDIR                     | /var/folders/ld/hwrvzn011w79gftyb6vj8mg40000gn/T/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 44 | USER                       | ldaniels                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| 45 | XPC_FLAGS                  | 0x0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 46 | XPC_SERVICE_NAME           | application.com.jetbrains.intellij.505803.110144030                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 47 | __CFBundleIdentifier       | com.jetbrains.intellij                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 48 | __CF_USER_TEXT_ENCODING    | 0x1F5:0x0:0x0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|

📦 oxide::compile — Compiles source code from a string input

example1
code = oxide::compile("2 ** 4")
code()
results
16

📦 oxide::debug — Compiles source code from a string input; returning a debug string

example1
oxide::debug("2 ** 4")
results
Ok(Pow(Literal(Number(I64Value(2))), Literal(Number(I64Value(4)))))

📦 oxide::eval — Evaluates a string containing Oxide code

example1
a = 'Hello '
b = 'World'
oxide::eval("a + b")
results
Hello World

📦 oxide::help — Integrated help function

example1
oxide::help() limit 3
results
|-------------------------------------------------------------------------------------------------------|
| id | name    | module | signature                           | description                   | returns |
|-------------------------------------------------------------------------------------------------------|
| 0  | version | oxide  | oxide::version()                    | Returns the Oxide version     | f64     |
| 1  | uuid    | oxide  | oxide::uuid()                       | Returns a random 128-bit UUID | u128    |
| 2  | sprintf | oxide  | oxide::sprintf(a: String, b: Array) | C-style "sprintf" function    | String  |
|-------------------------------------------------------------------------------------------------------|

📦 oxide::home — Returns the Oxide home directory path

example1
oxide::home()
results
/Users/ldaniels/oxide_db

📦 oxide::inspect — Returns a table describing the structure of a model

example1
oxide::inspect("{ x = 1 x = x + 1 }")
results
|-------------------------------------------------------------------------------------------------|
| id | code      | model                                                                          |
|-------------------------------------------------------------------------------------------------|
| 0  | x = 1     | SetVariables(Variable("x"), Literal(Number(I64Value(1))))                      |
| 1  | x = x + 1 | SetVariables(Variable("x"), Plus(Variable("x"), Literal(Number(I64Value(1))))) |
|-------------------------------------------------------------------------------------------------|

📦 oxide::inspect — Returns a table describing the structure of a model

example2
oxide::inspect("stock::is_this_you('ABC')")
results
|---------------------------------------------------------------------------------------------------------------------------------------------------|
| id | code                      | model                                                                                                            |
|---------------------------------------------------------------------------------------------------------------------------------------------------|
| 0  | stock::is_this_you("ABC") | ColonColon(Variable("stock"), FunctionCall { fx: Variable("is_this_you"), args: [Literal(StringValue("ABC"))] }) |
|---------------------------------------------------------------------------------------------------------------------------------------------------|

📦 oxide::printf — C-style "printf" function

example1
oxide::printf("Hello %s", "World")
results
true

📦 oxide::println — Print line function

example1
oxide::println("Hello World")
results
true

📦 oxide::reset — Clears the scope of all user-defined objects

example1
oxide::reset()
results
true

📦 oxide::sprintf — C-style "sprintf" function

example1
oxide::sprintf("Hello %s", "World")
results
Hello World

📦 oxide::uuid — Returns a random 128-bit UUID

example1
oxide::uuid()
results
fc9c5137-e246-4679-8ee5-53637ccc7992

📦 oxide::version — Returns the Oxide version

example1
oxide::version()
results
0.44

📦 str::ends_with — Returns true if string `a` ends with string `b`

example1
str::ends_with('Hello World', 'World')
results
true

📦 str::format — Returns an argument-formatted string

example1
str::format("This {} the {}", "is", "way")
results
This is the way

📦 str::index_of — Returns the index of string `b` in string `a`

example1
str::index_of('The little brown fox', 'brown')
results
11

📦 str::join — Combines an array into a string

example1
str::join(['1', 5, 9, '13'], ', ')
results
1, 5, 9, 13

📦 str::left — Returns n-characters from left-to-right

example1
str::left('Hello World', 5)
results
Hello

📦 str::len — Returns the number of characters contained in the string

example1
str::len('The little brown fox')
results
20

📦 str::right — Returns n-characters from right-to-left

example1
str::right('Hello World', 5)
results
World

📦 str::split — Splits string `a` by delimiter string `b`

example1
str::split('Hello,there World', ' ,')
results
["Hello", "there", "World"]

📦 str::starts_with — Returns true if string `a` starts with string `b`

example1
str::starts_with('Hello World', 'World')
results
false

📦 str::strip_margin — Returns the string with all characters on each line are striped up to the margin character

example1
str::strip_margin("
|Code example:
|
|stocks
|where exchange is 'NYSE'
", '|')
results

Code example:

stocks where exchange is 'NYSE'


📦 str::substring — Returns a substring of string `s` from `m` to `n`

example1
str::substring('Hello World', 0, 5)
results
Hello

📦 str::superscript — Returns a superscript of a number `n`

example1
str::superscript(5)
results

📦 str::to_string — Converts a value to its text-based representation

example1
str::to_string(125.75)
results
125.75

📦 tools::compact — Shrinks a table by removing deleted rows

example1
stocks = nsd::save(
   "examples.compact.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "DMX", exchange: "NYSE", last_sale: 99.99 },
 { symbol: "UNO", exchange: "OTC", last_sale: 0.2456 },
 { symbol: "BIZ", exchange: "NYSE", last_sale: 23.66 },
 { symbol: "GOTO", exchange: "OTC", last_sale: 0.1428 },
 { symbol: "ABC", exchange: "AMEX", last_sale: 11.11 },
 { symbol: "BOOM", exchange: "NASDAQ", last_sale: 0.0872 },
 { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 }] ~> stocks
delete stocks where last_sale > 1.0
stocks
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 1  | UNO    | OTC      | 0.2456    |
| 3  | GOTO   | OTC      | 0.1428    |
| 5  | BOOM   | NASDAQ   | 0.0872    |
|------------------------------------|

📦 tools::describe — Describes a table or structure

example1
tools::describe({
   symbol: "BIZ",
   exchange: "NYSE",
   last_sale: 23.66
})
results
|----------------------------------------------------------|
| id | name      | type      | default_value | is_nullable |
|----------------------------------------------------------|
| 0  | symbol    | String(3) | BIZ           | true        |
| 1  | exchange  | String(4) | NYSE          | true        |
| 2  | last_sale | f64       | 23.66         | true        |
|----------------------------------------------------------|

📦 tools::describe — Describes a table or structure

example2
stocks =
    |--------------------------------------|
    | symbol | exchange | last_sale | rank |
    |--------------------------------------|
    | BOOM   | NYSE     | 113.76    | 1    |
    | ABC    | AMEX     | 24.98     | 2    |
    | JET    | NASDAQ   | 64.24     | 3    |
    |--------------------------------------|
tools::describe(stocks)
results
|----------------------------------------------------------|
| id | name      | type      | default_value | is_nullable |
|----------------------------------------------------------|
| 0  | symbol    | String(4) | null          | true        |
| 1  | exchange  | String(6) | null          | true        |
| 2  | last_sale | f64       | null          | true        |
| 3  | rank      | i64       | null          | true        |
|----------------------------------------------------------|

📦 tools::fetch — Retrieves a raw structure from a table

example1
stocks = nsd::save(
   "examples.fetch.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "ABC", exchange: "AMEX", last_sale: 12.49 },
 { symbol: "BOOM", exchange: "NYSE", last_sale: 56.88 },
 { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 }] ~> stocks
tools::fetch(stocks, 2)
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 2  | JET    | NASDAQ   | 32.12     |
|------------------------------------|

📦 tools::filter — Filters a collection based on a function

example1
tools::filter(1..11, n -> (n % 2) == 0)
results
[2, 4, 6, 8, 10]

📦 tools::len — Returns the length of a table

example1
stocks = nsd::save(
   "examples.table_len.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "WKRP", exchange: "NYSE", last_sale: 11.11 },
 { symbol: "ACDC", exchange: "AMEX", last_sale: 35.11 },
 { symbol: "UELO", exchange: "NYSE", last_sale: 90.12 }] ~> stocks
tools::len(stocks)
results
3

📦 tools::map — Transform a collection based on a function

example1
stocks = nsd::save(
   "examples.map_over_table.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "WKRP", exchange: "NYSE", last_sale: 11.11 },
 { symbol: "ACDC", exchange: "AMEX", last_sale: 35.11 },
 { symbol: "UELO", exchange: "NYSE", last_sale: 90.12 }] ~> stocks
use tools
stocks:::map(row -> {
    symbol: symbol,
    exchange: exchange,
    last_sale: last_sale,
    processed_time: cal::now()
})
results
|---------------------------------------------------------------|
| id | symbol | exchange | last_sale | processed_time           |
|---------------------------------------------------------------|
| 0  | WKRP   | NYSE     | 11.11     | 2025-06-15T01:46:03.978Z |
| 1  | ACDC   | AMEX     | 35.11     | 2025-06-15T01:46:03.979Z |
| 2  | UELO   | NYSE     | 90.12     | 2025-06-15T01:46:03.980Z |
|---------------------------------------------------------------|

📦 tools::pop — Removes and returns a value or object from a Sequence

example1
use tools
stocks = nsd::save(
   "examples.tools_pop.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "ABC", exchange: "AMEX", last_sale: 12.49 },
 { symbol: "BOOM", exchange: "NYSE", last_sale: 56.88 },
 { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 }] ~> stocks
stocks:::pop()
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 2  | JET    | NASDAQ   | 32.12     |
|------------------------------------|

📦 tools::push — Appends a value or object to a Sequence

example1
use tools
stocks = nsd::save(
   "examples.tools_push.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "ABC", exchange: "AMEX", last_sale: 12.49 },
 { symbol: "BOOM", exchange: "NYSE", last_sale: 56.88 },
 { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 }] ~> stocks
stocks:::push({ symbol: "XYZ", exchange: "NASDAQ", last_sale: 24.78 })
stocks
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 0  | ABC    | AMEX     | 12.49     |
| 1  | BOOM   | NYSE     | 56.88     |
| 2  | JET    | NASDAQ   | 32.12     |
| 3  | XYZ    | NASDAQ   | 24.78     |
|------------------------------------|

📦 tools::reverse — Returns a reverse copy of a table, string or array

example1
use tools
to_table(reverse(
   ['cat', 'dog', 'ferret', 'mouse']
))
results
|-------------|
| id | value  |
|-------------|
| 0  | mouse  |
| 1  | ferret |
| 2  | dog    |
| 3  | cat    |
|-------------|

📦 tools::row_id — Returns the unique ID for the last retrieved row

example1
tools::row_id()
results
0

📦 tools::scan — Returns existence metadata for a table

example1
use tools
stocks = nsd::save(
   "examples.scan.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "ABC", exchange: "AMEX", last_sale: 12.33 },
 { symbol: "UNO", exchange: "OTC", last_sale: 0.2456 },
 { symbol: "BIZ", exchange: "NYSE", last_sale: 9.775 },
 { symbol: "GOTO", exchange: "OTC", last_sale: 0.1442 },
 { symbol: "XYZ", exchange: "NYSE", last_sale: 0.0289 }] ~> stocks
delete stocks where last_sale > 1.0
stocks:::scan()
results
|------------------------------------|
| id | symbol | exchange | last_sale |
|------------------------------------|
| 0  | ABC    | AMEX     | 12.33     |
| 1  | UNO    | OTC      | 0.2456    |
| 2  | BIZ    | NYSE     | 9.775     |
| 3  | GOTO   | OTC      | 0.1442    |
| 4  | XYZ    | NYSE     | 0.0289    |
|------------------------------------|

📦 tools::to_array — Converts a collection into an array

example1
tools::to_array("Hello")
results
["H", "e", "l", "l", "o"]

📦 tools::to_csv — Converts a collection to CSV format

example1
use tools::to_csv
stocks = nsd::save(
   "examples.csv.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "ABC", exchange: "AMEX", last_sale: 11.11 },
 { symbol: "UNO", exchange: "OTC", last_sale: 0.2456 },
 { symbol: "BIZ", exchange: "NYSE", last_sale: 23.66 },
 { symbol: "GOTO", exchange: "OTC", last_sale: 0.1428 },
 { symbol: "BOOM", exchange: "NASDAQ", last_sale: 0.0872 }] ~> stocks
stocks:::to_csv()
results
[""ABC","AMEX",11.11", ""UNO","OTC",0.2456", ""BIZ","NYSE",23.66", ""GOTO","OTC",0.1428", ""BOOM","NASDAQ",0.0872"]

📦 tools::to_json — Converts a collection to JSON format

example1
use tools::to_json
stocks = nsd::save(
   "examples.json.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "ABC", exchange: "AMEX", last_sale: 11.11 },
 { symbol: "UNO", exchange: "OTC", last_sale: 0.2456 },
 { symbol: "BIZ", exchange: "NYSE", last_sale: 23.66 },
 { symbol: "GOTO", exchange: "OTC", last_sale: 0.1428 },
 { symbol: "BOOM", exchange: "NASDAQ", last_sale: 0.0872 }] ~> stocks
stocks:::to_json()
results
["{"symbol":"ABC","exchange":"AMEX","last_sale":11.11}", "{"symbol":"UNO","exchange":"OTC","last_sale":0.2456}", "{"symbol":"BIZ","exchange":"NYSE","last_sale":23.66}", "{"symbol":"GOTO","exchange":"OTC","last_sale":0.1428}", "{"symbol":"BOOM","exchange":"NASDAQ","last_sale":0.0872}"]

📦 tools::to_table — Converts an object into a to_table

example1
tools::to_table(['cat', 'dog', 'ferret', 'mouse'])
results
|-------------|
| id | value  |
|-------------|
| 0  | cat    |
| 1  | dog    |
| 2  | ferret |
| 3  | mouse  |
|-------------|

📦 util::base64 — Translates bytes into Base 64

example1
util::base64('Hello World')
results
SGVsbG8gV29ybGQ=

📦 util::to_binary — Translates a numeric value into binary

example1
util::to_binary(0b1011 & 0b1101)
results
1001

📦 util::gzip — Compresses bytes via gzip

example1
util::gzip('Hello World')
results
0v1f8b08000000000000fff348cdc9c95708cf2fca49010056b1174a0b000000

📦 util::gunzip — Decompresses bytes via gzip

example1
util::gunzip(util::gzip('Hello World'))
results
0v48656c6c6f20576f726c64

📦 util::hex — Translates bytes into hexadecimal

example1
util::hex('Hello World')
results
48656c6c6f20576f726c64

📦 util::md5 — Creates a MD5 digest

example1
util::md5('Hello World')
results
0vb10a8db164e0754105b7a99be72e3fe5

📦 util::to — Converts a value to the desired type

example1
util::to(1376438453123, Date)
results
2013-08-14T00:00:53.123Z

📦 util::to_ascii — Converts an integer to ASCII

example1
util::to_ascii(177)
results
±

📦 util::to_date — Converts a value to Date

example1
util::to_date(177)
results
1970-01-01T00:00:00.177Z

📦 util::to_f64 — Converts a value to f64

example1
util::to_f64(4321)
results
4321

📦 util::to_i64 — Converts a value to i64

example1
util::to_i64(88)
results
88

📦 util::to_i128 — Converts a value to i128

example1
util::to_i128(88)
results
88

📦 util::to_u128 — Converts a value to u128

example1
util::to_u128(88)
results
88

📦 www::url_decode — Decodes a URL-encoded string

example1
www::url_decode('http%3A%2F%2Fshocktrade.com%3Fname%3Dthe%20hero%26t%3D9998')
results
http://shocktrade.com?name=the hero&t=9998

📦 www::url_encode — Encodes a URL string

example1
www::url_encode('http://shocktrade.com?name=the hero&t=9998')
results
http%3A%2F%2Fshocktrade.com%3Fname%3Dthe%20hero%26t%3D9998

📦 www::serve — Starts a local HTTP service

example1
www::serve(8787)
stocks = nsd::save(
   "examples.www.stocks",
   Table::new(symbol: String(8), exchange: String(8), last_sale: f64)
)
[{ symbol: "XINU", exchange: "NYSE", last_sale: 8.11 },
 { symbol: "BOX", exchange: "NYSE", last_sale: 56.88 },
 { symbol: "JET", exchange: "NASDAQ", last_sale: 32.12 },
 { symbol: "ABC", exchange: "AMEX", last_sale: 12.49 },
 { symbol: "MIU", exchange: "OTCBB", last_sale: 2.24 }] ~> stocks
GET http://localhost:8787/examples/www/stocks/1/4
results
[{"exchange":"NYSE","last_sale":56.88,"symbol":"BOX"}, {"exchange":"NASDAQ","last_sale":32.12,"symbol":"JET"}, {"exchange":"AMEX","last_sale":12.49,"symbol":"ABC"}]

About

Oxide is a hybrid database and streaming messaging system (think Kafka + MySQL); supporting data access via REST and SQL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0