@onehat/data
Version:
JS data modeling package with adapters for many storage mediums.
1,044 lines (373 loc) • 15.1 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>@onehat/data Class: MemoryRepository</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.yeti.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top ">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">@onehat/data</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="module-Entity.html">Entity</a></li><li><a href="module-OneHatData.html">OneHatData</a></li><li><a href="module-Property.html">Property</a></li><li><a href="module-Reader.html">Reader</a></li><li><a href="module-Repository.html">Repository</a></li><li><a href="module-Schema.html">Schema</a></li><li><a href="module-Writer.html">Writer</a></li><li><a href="module-@onehat_data.html">@onehat/data</a></li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="module-Entity-Entity.html">Entity~Entity</a></li><li><a href="module-OneHatData.OneHatData.html">OneHatData.OneHatData</a></li><li><a href="module-Reader-JsonReader.html">Reader~JsonReader</a></li><li><a href="module-Reader-Reader.html">Reader~Reader</a></li><li><a href="module-Reader-XmlReader.html">Reader~XmlReader</a></li><li><a href="module-Repository-AjaxRepository.html">Repository~AjaxRepository</a></li><li><a href="module-Repository-CommandRepository.html">Repository~CommandRepository</a></li><li><a href="module-Repository-LocalFromRemoteRepository.html">Repository~LocalFromRemoteRepository</a></li><li><a href="module-Repository-MemoryRepository.html">Repository~MemoryRepository</a></li><li><a href="module-Repository-NullRepository.html">Repository~NullRepository</a></li><li><a href="module-Repository-OfflineRepository.html">Repository~OfflineRepository</a></li><li><a href="module-Repository-OneBuildRepository.html">Repository~OneBuildRepository</a></li><li><a href="module-Repository-RestRepository.html">Repository~RestRepository</a></li><li><a href="module-Writer-JsonWriter.html">Writer~JsonWriter</a></li><li><a href="module-Writer-Writer.html">Writer~Writer</a></li><li><a href="module-Writer-XmlWriter.html">Writer~XmlWriter</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content">
<div class="row">
<div class="col-md-8">
<div id="main">
<h1 class="page-title">Class: MemoryRepository</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-Repository.html">Repository</a>~</span>
MemoryRepository
</h2>
<div class="class-description">Stores all of its data in local memory as JSON.
Does not persist anything to permanent storage.
See subclasses for implementations that do persist data
to permanent storage.</div>
</header>
<article>
<div class="container-overview">
<hr>
<dt>
<h4 class="name" id="MemoryRepository"><span class="type-signature"></span>new MemoryRepository()</h4>
</dt>
<dd>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li>Repository</li>
</ul>
<h3 class="subsection-title">Members</h3>
<dl>
<hr>
<dt class="name" id="load">
<h4 id="load"><span class="type-signature"></span>load<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Loads data into the Repository.
This loads *all* data, not just the data for a single page.
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="_loadFromStorage">
<h4 id="_loadFromStorage"><span class="type-signature"></span>_loadFromStorage<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Helper for load.
Gets initial data from storage medium.
This is mainly used for subclasses of MemoryRepository.
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="deleteAll">
<h4 id="deleteAll"><span class="type-signature"></span>deleteAll<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Deletes all entities in repository
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="getById">
<h4 id="getById"><span class="type-signature"></span>getById<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Get an entity directly from its id.
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="getAll">
<h4 id="getAll"><span class="type-signature"></span>getAll<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Get an array of all active Entities,
with sorting and filtering applied.
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="getGrandTotal">
<h4 id="getGrandTotal"><span class="type-signature"></span>getGrandTotal<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Gets the total number of Entities in the storage medium,
before any sorting or filtering is applied.
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="_getActiveEntities">
<h4 id="_getActiveEntities"><span class="type-signature"></span>_getActiveEntities<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Gets the "active" Entities in the store.
If filtering is applied, this is the number of items that have passed the filter.
If sorting is applied, this is the number of sorted items.
Otherwise, this is equal to the
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<hr>
<dt>
<h4 class="name" id="reload"><span class="type-signature"></span>reload()</h4>
</dt>
<dd>
<div class="description">
Override base Repository, because we don't need to reload, but rather _recalculate.
Tells the Repository to reload its data from the storage medium,
using previous settings
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="isInRepository"><span class="type-signature"></span>isInRepository()</h4>
</dt>
<dd>
<div class="description">
Detects if entity is in the storage medium.
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
Repository/Memory.js
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
isInRepository
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-3">
<div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
</div>
</div>
</div>
<div class="modal fade" id="searchResults">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Search results</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<footer>
<div style="text-align:center;"><p><a href="https://www.npmjs.com/package/@onehat/data">@onehat/data NPM Module</a></p><p><a href="https://github.com/OneHatRepo/data">@onehat/data Github Repo</a></p></div
<span class="copyright">
<div style="text-align:center;"><p>©2020 OneHat Technologies, LLC</p></div>
</span>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.5</a>
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
</footer>
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/toc.js"></script>
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
lang = langClassMatch ? langClassMatch[1] : "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
$.catchAnchorLinks( {
navbarOffset: 10
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
showAndHide : false,
smoothScrolling: true
} );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
$( "table" ).each( function () {
var $this = $( this );
$this.addClass('table');
} );
} );
</script>
<!--Navigation and Symbol Display-->
<script>
$( function () {
$( '#main' ).localScroll( {
offset : { top : 60 } //offset by the height of your header (give or take a few px, see what works for you)
} );
$( "dt.name" ).each( function () {
var $this = $( this ).find("h4");
var icon = $( "<i/>" ).addClass( "icon-plus-sign" ).addClass( "pull-right" ).addClass( "icon-white" );
var dt = $(this);
var children = dt.next( "dd" );
dt.prepend( icon ).css( {cursor : "pointer"} );
dt.addClass( "member-collapsed" ).addClass( "member" );
children.hide();
dt.children().on( "click", function () {
children = dt.next( "dd" );
children.slideToggle( "fast", function () {
if ( children.is( ":visible" ) ) {
icon.addClass( "icon-minus-sign" ).removeClass( "icon-plus-sign" ).removeClass( "icon-white" );
dt.addClass( "member-open" ).animate( "member-collapsed" );
} else {
icon.addClass( "icon-plus-sign" ).removeClass( "icon-minus-sign" ).addClass( "icon-white" );
dt.addClass( "member-collapsed" ).removeClass( "member-open" );
}
} );
} );
} );
} );
</script>
<!--Google Analytics-->
<script type="text/javascript">
$(document).ready(function() {
SearcherDisplay.init();
});
</script>
</body>
</html>