Create the Redis module with native functions
(ctx: Context)
| 17 | |
| 18 | // Create the Redis module with native functions |
| 19 | pub fn create_redis_module(ctx: Context) -> ModuleKind { |
| 20 | let name = ctx.intern(b"std.db.redis"); |
| 21 | |
| 22 | let exports = [ |
| 23 | ("cmd", Value::NativeFunction(NativeFn(redis_cmd))), |
| 24 | ( |
| 25 | "pipeline", |
| 26 | Value::NativeFunction(NativeFn(pipeline::begin_pipeline)), |
| 27 | ), |
| 28 | ] |
| 29 | .into_iter() |
| 30 | .map(|(name, f)| (ctx.intern_static(name), f)) |
| 31 | .collect(); |
| 32 | |
| 33 | ModuleKind::Native { name, exports } |
| 34 | } |
| 35 | |
| 36 | // Convert Redis value to AIScript value |
| 37 | fn redis_to_value(ctx: Context, value: RedisValue) -> Value { |
no test coverage detected