Skip to content

ndb Functions Reference

The function API only available if you’ve imported the NimbusDBFnAPI script asset. The ndb functions are designed for users who prefer a functional programming style over the object-oriented (OOP) approach provided by NimbusDB core classes.

Before you can use the ndb functions, ensure that you’ve included the NimbusDBFnAPI script in your project.

To use the ndb functions, you can call them directly in your code, with the first parameter being the class instance they operate on.

// (1) creating a new class instance
var my_model = new NimbusDBModel(id, "my_model"); // OOP style
var my_model = ndb_create_model(id, "my_model"); // functional style
// (2) calling a method on the class instance
my_model.insert({ id: 1, name: "Apple", price: 5 }); // OOP style
ndb_insert(my_model, { id: 1, name: "Apple", price: 5 }); // functional style
// (3) getting a return value from the function
var apple = my_model.get_by_primary(1); // OOP style
var apple = ndb_get_by_primary(my_model, 1); // functional style

See Model.computed() for details.

See Model.expose() for details.

See Model.cross_join() for details.

See Model.unexpose() for details.

See Model constructor for details. Substitute new NimbusDBModel for ndb_create_model.

See Model.define_relation() for details.

See Model.derived() for details.

Destroys a model instance.

model.d.ts
function ndb_destroy_model(
_model: NimbusDBModel
): void;
  • Type: NimbusDBModel
  • The model instance to operate on.
var model = ndb_create_model("items", {
id: {
type: NIMBUSDB_DATA_TYPE.INTEGER,
const: NIMBUSDB_CONSTRAINT.PRIMARY_KEY
},
name: NIMBUSDB_DATA_TYPE.STRING,
price: {
type: NIMBUSDB_DATA_TYPE.NUMBER,
validator: function(data, value) {
return value >= 0;
},
default_value: 0
},
is_locked: {
type: NIMBUSDB_DATA_TYPE.BOOLEAN,
const: NIMBUSDB_CONSTRAINT.OPTIONAL,
default_value: false
}
});
ndb_destroy_model(model);

See Model.drop_relation() for details.

See Model.export_csv() for details.

See Model.export_json() for details.

See Model.export_ndbin() for details.

See Model.find() for details.

See Model.full_join() for details.

See Model.get_alias() for details.

See:

See:

See:

See Model.get_count() for details.

See Model.get_relation() for details.

See Model.import_csv() for details.

See Model.import_json() for details.

See Model.import_ndbin() for details.

See Model.inner_join() for details.

See Model.insert() for details.

See Model.left_join() for details.

See Model.migrate() for details.

See Model.print() for details.

See:

See Model.right_join() for details.

See Model.transaction() for details.

See:

See Model.upsert() for details.

See Model.watch() for details.

See Catalog.backup() for details.

See Catalog.add_model() for details.

See Catalog.clear() for details.

See Catalog.define() for details.

See Catalog.define_relation() for details.

See Catalog.define_mutual_relation() for details.

See Catalog.drop() for details.

See Catalog.drop_relation() for details.

See Catalog.get_relation() for details.

See Catalog.has() for details.

See Catalog.list() for details.

See Catalog.transaction() for details.

See Catalog.use() for details.

See Catalog constructor for details. Substitute new NimbusDBCatalog for ndb_create_catalog.

Destroys a catalog instance.

catalog.d.ts
function ndb_destroy_catalog(
_catalog: NimbusDBCatalog
): void;
  • Type: NimbusDBCatalog
  • The catalog instance to operate on.
var catalog = ndb_create_catalog("my_catalog");
ndb_destroy_catalog(catalog);

See Catalog.restore() for details.