Wetland

Through wetland we are able to connect with the database, register entities and access methods that belong to different classes throughout the ORM. Here we are going to describe all of its methods and how to use them.

let wetland = new Wetland();

.destroyConnections()

This method destroys all active connections, returning a Promise.

wetland.destroyConnections();

.getConfig()

Gets the wetland config.

wetland.getConfig();

.getManager()

This method gets a scoped entity manager.

wetland.getManager();

.getMigrator()

This method returns an instance of migrator, that you can use to create and run your database migrations.

wetland.getMigrator();

.getStore()

Gets a store by name. If no name is given, this method will return the default store.

wetland.getStore('store');

.registerEntities()

This method register multiple entities with the entity manager. Using this method is another way to register your entities, if you decide not to register them upon creating a wetland instance.

wetland.registerEntities([entity1, entity2]);

.registerEntity()

Just like .registerEntities(), but only registering one entity with the entity manager.

wetland.registerEntity(entity);

.registerStore()

This method registers a store with wetland. The first registered store using this method will be set as the default store. The second argument is an object with your store configuration.

wetland.registerStore('myStore', {config: {...}});

.registerStores()

Registers multiple stores with wetland. Stores must be passed as a single object.

let stores = {
  store1 : {...},
  store2 : {...}
};

wetland.registerStores(stores);

results matching ""

    No results matching ""