Files
legolog/jsdoc/entity-relationships.js.html
Ben 3a01f3e09a jsdoc
Former-commit-id: a4bbfeb13d86b2591c4ee861f9449231b2b8f2b5
2022-02-11 15:13:21 +00:00

102 lines
2.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: entity-relationships.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: entity-relationships.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>const Logger = require('../../logger.js');
const DataTypes = require('./types.js');
const Model = require('./model.js');
/**
* In order to keep the models dynamic and flexible, we need to be able to add
* new models to the database in whatever order the developer wants too. Without
* them worrying about dependancies and such, we can just add them to the database
* in the order they are defined. This class will handle that for us. As well as
* keeping track of the models that have been added to the database.
*/
/**
* @class Database
* @classdesc The Database class is used to create a database instance.
* @param {object} connection - An active instance of a psql database connection
*/
class PSQLObjectRelation {
constructor(psqlConnection) {
Logger.Database('ORM Loading...');
this.connection = psqlConnection;;
this.models = [];
}
model(modelName) {
return { }
}
addModel(name, model, constraints) {
Logger.Database(`ORM Adding ${name}`);
const keys = Object.keys(model);
this.models[name] = new Model;
}
resolveDepends() {
}
// ONLY run this after all models are properly added
async syncModels() {
Logger.Database('ORM Syncing...');
}
}
module.exports = PSQLObjectRelation;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Database.html">Database</a></li><li><a href="Model.html">Model</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Feb 11 2022 15:12:15 GMT+0000 (Greenwich Mean Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>