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

Function InitAll

src/better_sqlite3.cpp:49–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected