Skip to main content

ODFormattedJsonDatabase class

under construction

We are still working the API Reference! This page might be incomplete or doesn't contain all details!

Overview​

This is an Open Ticket Formatted JSON database. It stores data in a json file as a large Array using the category, key, value strategy. You can store the following types: string, number, boolean, array, object & null!

This one is exactly the same as ODJsonDatabase, but it has a formatter from the formatted-json-stringify package. This can help you organise it a little bit better!

View Source

Properties​


inherited file string ➜ string​

The name of the file with extension.

View Source


formatter type ➜ formatted-json-stringify.ArrayFormatter​

The formatter to use on the database array

View Source


inherited id class ➜ api.ODId​

The id of this data.

View Source


inherited path string ➜ string​

The path to the file relative to the main directory.

View Source


Methods​


constructor() function ➜ api.ODFormattedJsonDatabase​

(no description)

View Parameters (4)
  • id: type ➜ api.ODValidId - Parameter Description Lorem Ipsum.
  • file: string ➜ string - Parameter Description Lorem Ipsum.
  • formatter: type ➜ formatted-json-stringify.ArrayFormatter - Parameter Description Lorem Ipsum.
  • customPath: string ➜ string - Parameter Description Lorem Ipsum.

View Source


inherited protected _change() function ➜ void​

Trigger an onChange() event in the parent ODManager of this class.

View Source


inherited changed() function ➜ void​

(❌ SYSTEM ONLY!!) Set the callback executed when a value inside this class changes.

View Parameters (1)
  • callback: type ➜ null|(() => void) - Parameter Description Lorem Ipsum.

View Source


delete() function ➜ api.ODOptionalPromise​

Remove the value of category & key. Returns undefined when non-existent!

View Parameters (2)
  • category: string ➜ string - Parameter Description Lorem Ipsum.
  • key: string ➜ string - Parameter Description Lorem Ipsum.

View Source


exists() function ➜ api.ODOptionalPromise​

Check if a value of category & key exists. Returns false when non-existent!

View Parameters (2)
  • category: string ➜ string - Parameter Description Lorem Ipsum.
  • key: string ➜ string - Parameter Description Lorem Ipsum.

View Source


get() function ➜ api.ODOptionalPromise​

Get the value of category & key. Returns undefined when non-existent!

View Parameters (2)
  • category: string ➜ string - Parameter Description Lorem Ipsum.
  • key: string ➜ string - Parameter Description Lorem Ipsum.

View Source


getAll() function ➜ api.ODOptionalPromise​

Get all values in category.

View Source


getCategory() function ➜ api.ODOptionalPromise​

Get all values in category. Returns undefined when non-existent!

View Parameters (1)
  • category: string ➜ string - Parameter Description Lorem Ipsum.

View Source


init() function ➜ api.ODPromiseVoid​

Init the database.

View Source


set() function ➜ api.ODOptionalPromise​

Set/overwrite the value of category & key. Returns true when overwritten!

View Parameters (3)
  • category: string ➜ string - Parameter Description Lorem Ipsum.
  • key: string ➜ string - Parameter Description Lorem Ipsum.
  • value: type ➜ api.ODValidJsonType - Parameter Description Lorem Ipsum.

View Source


Defaults​

under construction

We're still working on this part of the documentation!

Examples​

under construction

We're still working on this part of the documentation!