storage/sqlite
# 介绍
存储模块 - sqlite数据库。
# 使用方法
const { SqliteStorage } = require('ee-core/storage');
# API列表
# sqlite数据库
const dbFile = path.join(getDataDir(), "db", this.dbname);
const sqliteOptions = {
timeout: 6000,
verbose: console.log
}
this.storage = new SqliteStorage(dbFile, sqliteOptions);
this.db = this.storage.db;
# storage.db
# 插入数据
const insert = this.db.prepare(`INSERT INTO ${table} (name, age) VALUES (@name, @age)`);
insert.run(data);
# storage.name
db名称
# storage.mode
路径模式:":memory:", "absolute", "relative", "onlyName"
# storage.getDbDir
获取 db 文件目录
# storage.fileName
格式化后的db名称
上次更新: 2025/04/10, 03:07:49