Home Reference Source
public class | source

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)

Member Summary

Public Members
public

knex: *

public

models: *

public

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:

NameTypeAttributeDescription
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 Members

public knex: * source

public models: * source

public processedModels: * source

Public Methods

public generateQueryFor(modelId: String): * source

Creates a query object for the chosen model.

Params:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
modelId String

The modelId of the requested view name

Return:

*