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

Function create_transaction_class

aiscript-vm/src/stdlib/db/pg.rs:390–416  ·  view source on GitHub ↗
(ctx: Context)

Source from the content-addressed store, hash-verified

388 use super::*;
389
390 fn create_transaction_class(ctx: Context) -> Gc<RefLock<Class>> {
391 let methods = [
392 (ctx.intern(b"query"), Value::NativeFunction(NativeFn(query))),
393 (
394 ctx.intern(b"query_as"),
395 Value::NativeFunction(NativeFn(query_as)),
396 ),
397 (
398 ctx.intern(b"commit"),
399 Value::NativeFunction(NativeFn(commit)),
400 ),
401 (
402 ctx.intern(b"rollback"),
403 Value::NativeFunction(NativeFn(rollback)),
404 ),
405 ]
406 .into_iter()
407 .collect();
408 Gc::new(
409 &ctx,
410 RefLock::new(Class {
411 name: ctx.intern(b"Transaction"),
412 methods,
413 static_methods: HashMap::default(),
414 }),
415 )
416 }
417
418 pub(super) fn begin_transaction<'gc>(
419 state: &mut State<'gc>,

Callers 1

begin_transactionFunction · 0.70

Calls 2

NativeFnClass · 0.85
internMethod · 0.45

Tested by

no test coverage detected