MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / create_redis_module

Function create_redis_module

aiscript-vm/src/stdlib/db/redis.rs:19–34  ·  view source on GitHub ↗

Create the Redis module with native functions

(ctx: Context)

Source from the content-addressed store, hash-verified

17
18// Create the Redis module with native functions
19pub 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
37fn redis_to_value(ctx: Context, value: RedisValue) -> Value {

Callers 1

init_stdlibMethod · 0.85

Calls 3

NativeFnClass · 0.85
internMethod · 0.45
intern_staticMethod · 0.45

Tested by

no test coverage detected