Visions
Factory class for generating queries for a set of views that are "overlayed" over the model schema.
Constructor Summary
Public Constructor | ||
public |
constructor(models: JoinJsMap, knex: KnexInstance, views: Object) |
Method Summary
Public Methods | ||
public |
generateQueryFor(modelId: String): * Creates a query object for the chosen model. |
|
public |
getViewNameFor(modelId: String): * Returns the name of the view for the model. |
Public Constructors
public constructor(models: JoinJsMap, knex: KnexInstance, views: Object) source
Params:
Name | Type | Attribute | Description |
models | JoinJsMap | The complete schema of the database (using joinjs structure) |
|
knex | KnexInstance | A knex instance, configured for access to the database |
|
views | Object | A mapping from modelId to view |
Public Methods
public generateQueryFor(modelId: String): * source
Creates a query object for the chosen model.
Params:
Name | Type | Attribute | Description |
modelId | String | The model to query |
Return:
* |
public getViewNameFor(modelId: String): * source
Returns the name of the view for the model. Used for constructing queries directly with knex when they are beyond the scope of this wrapper to generate effectively.
Params:
Name | Type | Attribute | Description |
modelId | String | The modelId of the requested view name |
Return:
* |