MCPcopy Create free account
hub / github.com/WiseLibs/better-sqlite3 / InitAll

Function InitAll

src/better_sqlite3.cpp:48–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46#include "objects/statement-iterator.cpp"
47
48Napi::Object InitAll(Napi::Env env, Napi::Object exports) {
49 Napi::HandleScope scope(env);
50 Addon::ConfigureURI();
51
52 // Initialize addon instance. The addon is bound to each native-backed class
53 // as callback data (rather than per-environment instance data) so that
54 // multiple copies of the addon can be loaded into a single environment.
55 Addon* addon = new Addon(env);
56 env.AddCleanupHook(Addon::Cleanup, addon);
57
58 // Create and export native-backed classes and functions.
59 exports.Set("Database", Database::Init(env, addon));
60 exports.Set("Statement", Statement::Init(env, addon));
61 exports.Set("StatementIterator", StatementIterator::Init(env, addon));
62 exports.Set("Backup", Backup::Init(env, addon));
63 exports.Set("initialize", Napi::Function::New(env, Addon::JS_initialize, "initialize", addon));
64
65 // Store addon instance data.
66 addon->Statement = Napi::Persistent(exports.Get("Statement").As<Napi::Function>());
67 addon->StatementIterator = Napi::Persistent(exports.Get("StatementIterator").As<Napi::Function>());
68 addon->Backup = Napi::Persistent(exports.Get("Backup").As<Napi::Function>());
69
70 return exports;
71}
72
73NODE_API_MODULE(better_sqlite3, InitAll)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected