mirror of https://gitee.com/bigwinds/arangodb
73 lines
1.8 KiB
Plaintext
73 lines
1.8 KiB
Plaintext
!CHAPTER Details on FoxxRepository
|
|
|
|
A repository is a gateway to the database. It gets data from the database, updates it or saves new data. It uses the given model when it returns a model and expects instances of the model for methods like save. In your repository file, export the repository as *repository*.
|
|
|
|
```javascript
|
|
Foxx = require("org/arangodb/foxx");
|
|
|
|
TodosRepository = Foxx.Repository.extend({
|
|
});
|
|
|
|
exports.repository = TodosRepository;
|
|
```
|
|
|
|
!SUBSUBSECTION Initialize
|
|
|
|
@startDocuBlock JSF_foxx_repository_initializer
|
|
|
|
!SUBSECTION Attributes of a Repository
|
|
|
|
!SUBSUBSECTION Collection
|
|
|
|
@startDocuBlock JSF_foxx_repository_collection
|
|
|
|
!SUBSUBSECTION ModelPrototype
|
|
|
|
@startDocuBlock JSF_foxx_repository_modelPrototype
|
|
|
|
!SUBSUBSECTION Prefix
|
|
|
|
@startDocuBlock JSF_foxx_repository_prefix
|
|
|
|
!SUBSECTION Methods of a Repository
|
|
|
|
!SUBSUBSECTION Adding entries to the repository
|
|
|
|
@startDocuBlock JSF_foxx_repository_save
|
|
|
|
!SUBSECTION Finding entries in the repository
|
|
|
|
@startDocuBlock JSF_foxx_repository_byId
|
|
|
|
@startDocuBlock JSF_foxx_repository_byExample
|
|
|
|
@startDocuBlock JSF_foxx_repository_firstExample
|
|
|
|
@startDocuBlock JSF_foxx_repository_all
|
|
|
|
!SUBSUBSECTION Removing entries from the repository
|
|
|
|
@startDocuBlock JSF_foxx_repository_remove
|
|
|
|
@startDocuBlock JSF_foxx_repository_removeById
|
|
|
|
@startDocuBlock JSF_foxx_repository_removeByExample
|
|
|
|
!SUBSUBSECTION Replacing entries in the repository
|
|
|
|
@startDocuBlock JSF_foxx_repository_replace
|
|
|
|
@startDocuBlock JSF_foxx_repository_replaceById
|
|
|
|
@startDocuBlock JSF_foxx_repository_replaceByExample
|
|
|
|
!SUBSUBSECTION Updating entries in the repository
|
|
|
|
@startDocuBlock JSF_foxx_repository_updateById
|
|
|
|
@startDocuBlock JSF_foxx_repository_updateByExample
|
|
|
|
!SUBSUBSECTION Counting entries in the repository
|
|
|
|
@startDocuBlock JSF_foxx_repository_count
|