blackcat.js-database - v1.0.6
    Preparing search index...

    Class SQLiteDriver

    Driver lưu trữ dữ liệu bằng SQLite.

    ⚠️ Đây không phải database chính. Class này chỉ là driver lưu trữ phụ trợ cho Database.

    Logic xử lý dữ liệu như:

    • parse key path
    • update object
    • validation

    sẽ được thực hiện bởi class Database.

    Driver này chỉ:

    • serialize database thành JSON
    • lưu JSON vào SQLite
    • trả về JSON khi đọc

    Toàn bộ database được lưu trong một row duy nhất.

    const database = new Database({
    driver: new SQLiteDriver({
    filePath: "database.sqlite",
    table: "json_store"
    })
    })
    Index

    Constructors

    Methods

    Constructors

    • Khởi tạo SQLiteDriver.

      Parameters

      • options: SQLiteDriverOptions = {}

      Returns SQLiteDriver

      const database = new Database({
      driver: new SQLiteDriver({
      filePath: "database.sqlite",
      table: "json_store"
      })
      })

    Methods

    • Lấy toàn bộ dữ liệu database từ SQLite.

      Type Parameters

      • T = any

        Kiểu dữ liệu database.

      Returns Promise<T>

    • Reset toàn bộ database.

      Returns Promise<boolean>

    • Ghi toàn bộ database vào SQLite.

      ⚠️ Method này không xử lý key-path. Database đã cập nhật object trước khi truyền vào đây.

      Type Parameters

      • T = any

      Parameters

      • data: T

        Toàn bộ database object

      Returns Promise<T>