Constructor
new SenecaEntityWrapper(entity)
Parameters:
| Name | Type | Description | 
|---|---|---|
entity | 
            
            Object | The entity returned when you call the real
  | 
        
Methods
list$(query) → {Promise}
Returns a list of entities.
Parameters:
| Name | Type | Description | 
|---|---|---|
query | 
            
            Object | The query to pass down to the internal seneca instance. The query dsl will depdend on what kind of module you're using with the entity module.  | 
        
Returns:
- Type
 - Promise
 
Example
const allPersons = seneca.make('person').list$({ all$: true });
        
            
    
    load$(query) → {Promise}
Loads an entity.
Parameters:
| Name | Type | Description | 
|---|---|---|
query | 
            
            Object | Query to pass down to the internal seneca instance.  | 
        
Returns:
- Type
 - Promise
 
Example
const funnyJoe = seneca
  .make('person')
  .load$({ funny: true, name: 'Joe' });
        
            
    
    remove$(query) → {Promise}
Removes the given entity
Parameters:
| Name | Type | Description | 
|---|---|---|
query | 
            
            Object | The query to pass to the internal seneca instance. If not specified will use the fields stored on the entity itself.  | 
        
Returns:
- Type
 - Promise
 
Example
// Creates then removes the entity immediately.
seneca
  .make('person')
  .save$({ name: 'foobar' })
  .then((ent) => ent.remove$());
        
            
    
    save$(obj) → {Promise}
Saves the stored entity
Parameters:
| Name | Type | Description | 
|---|---|---|
obj | 
            
            Object | Optional object to use for saving. If not specified it will use the members on the entity object itself as the data to save.  | 
        
Returns:
- Type
 - Promise
 
Example
const ent = seneca.make('person');
ent.id = 1;
ent.name = 'foobar';
ent.save$(); // => Promise