MCPcopy Create free account
hub / github.com/erans/pgsqlite / register_array_ndims

Function register_array_ndims

src/functions/array_functions.rs:145–161  ·  view source on GitHub ↗

array_ndims(array) - Get number of dimensions

(conn: &Connection)

Source from the content-addressed store, hash-verified

143
144/// array_ndims(array) - Get number of dimensions
145fn register_array_ndims(conn: &Connection) -> Result<()> {
146 conn.create_scalar_function(
147 "array_ndims",
148 1,
149 FunctionFlags::SQLITE_UTF8 | FunctionFlags::SQLITE_DETERMINISTIC,
150 |ctx| {
151 let array_json: String = ctx.get(0)?;
152
153 match serde_json::from_str::<JsonValue>(&array_json) {
154 Ok(json) => Ok(Some(count_dimensions(&json))),
155 _ => Ok(None),
156 }
157 },
158 )?;
159
160 Ok(())
161}
162
163/// array_append(array, element) - Append element to array
164fn register_array_append(conn: &Connection) -> Result<()> {

Callers 1

register_array_functionsFunction · 0.85

Calls 2

count_dimensionsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected