lib/index.js
function getBelongsToDetails(fkc) {
    logger.debug('belongsTo details are calculated for: %s', fkc.name());
    var model   = getModelNameFor(fkc.referencesTable()),
        as      = getBelongsToName(fkc);

    return filterAttributes({
        type                : 'belongsTo',
        source              : 'generator',
        name                : fkc.name(),
        model               : model,
        as                  : getAlias(fkc.table(), as, 'belongsTo'),
        targetSchema        : fkc.referencesTable().schema().name(),
        targetTable         : fkc.referencesTable().name(),
        foreignKey          : fkc.foreignKey(0).name(), // Sequelize support single key only
        onDelete            : fkc.onDelete(),
        onUpdate            : fkc.onUpdate()
    });
}
function getBelongsToDetails(fkc) {
    logger.debug('belongsTo details are calculated for: %s', fkc.name());
    var model   = getModelNameFor(fkc.referencesTable()),
        as      = getBelongsToName(fkc);

    return filterAttributes({
        type                : 'belongsTo',
        source              : 'generator',
        name                : fkc.name(),
        model               : model,
        as                  : getAlias(fkc.table(), as, 'belongsTo'),
        targetSchema        : fkc.referencesTable().schema().name(),
        targetTable         : fkc.referencesTable().name(),
        foreignKey          : fkc.foreignKey(0).name(), // Sequelize support single key only
        onDelete            : fkc.onDelete(),
        onUpdate            : fkc.onUpdate()
    });
}
function getBelongsToDetails ( fkc ) { logger . debug ( 'belongsTo details are calculated for: %s' , fkc . name ( ) ) ; var model = getModelNameFor ( fkc . referencesTable ( ) ) , as = getBelongsToName ( fkc ) ; return filterAttributes ( { type : 'belongsTo' , source : 'generator' , name : fkc . name ( ) , model : model , as : getAlias ( fkc . table ( ) , as , 'belongsTo' ) , targetSchema : fkc . referencesTable ( ) . schema ( ) . name ( ) , targetTable : fkc . referencesTable ( ) . name ( ) , foreignKey : fkc . foreignKey ( 0 ) . name ( ) , // Sequelize support single key only onDelete : fkc . onDelete ( ) , onUpdate : fkc . onUpdate ( ) } ) ; }
Returns belongsTo details as plain object to use in templates.
@private
@param {object} fkc - pg-structure belongsTo object
@returns {Object} - Simple object to use in template
Returns belongsTo details as plain object to use in templates .