Home > git-documentdb > GitDocumentDB
GitDocumentDB class#
Main class of GitDocumentDB
Signature:GitDDBInterface , CRUDInterface , CollectionInterface , SyncEventInterface
Remarks#
Call open() before using DB.
Constructors#
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(options) | Constructor |
Properties#
| Property | Modifiers | Type | Description |
|---|---|---|---|
| author | { name: string; email: string; } | Author name and email for commit | |
| committer | { name: string; email: string; } | Committer name and email for commit | |
| dbId | string | Get dbId | |
| dbName | string | A name of a Git repository | |
| defaultBranch | (not declared) | Default Git branch | |
| isClosing | boolean | DB is going to close | |
| isOpened | boolean | Test if a database is opened | |
| localDir | string | A local directory path that stores repositories of GitDocumentDB | |
| logger | ColoredLogger | Get logger | |
| logLevel | TLogLevelName | logLevel ('silly' | 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal') | |
| logToTransport | ((logObject: ILogObject) => void) | undefined | logToTransport function for all log levels. See https://tslog.js.org/\#/?id=transports | |
| rootCollection | ICollection | Default collection whose collectionPath is ''. | |
| schema | Schema | Schema for specific document type | |
| serializeFormat | SerializeFormatJSON | SerializeFormatFrontMatter | ||
| taskQueue | TaskQueue | Task queue | |
| tsLogger | Logger | Get logger | |
| validator | Validator | Name validator | |
| workingDir | string | Get a full path of the current Git working directory |
Methods#
| Method | Modifiers | Description |
|---|---|---|
| close(options) | Close a database | |
| collection(collectionPath, options) | Get a collection | |
| delete(_id, options) | Delete a JSON document | |
| delete(jsonDoc, options) | Delete a document by _id property in JsonDoc | |
| deleteFatDoc(name, options) | Delete a data | |
| destroy(options) | Destroy a database | |
| find(options) | Get all the JSON documents | |
| findFatDoc(options) | Get all the FatDoc data | |
| get(_id) | Get a JSON document | |
| getCollections(dirPath) | Get collections | |
| getCommit(oid) | Get a commit object | |
| getDocByOid(fileOid, docType) | Get a Doc which has specified oid | |
| getFatDoc(name, getOptions) | Get a FatDoc data | |
| getFatDocHistory(name, historyOptions, getOptions) | Get revision history of a FatDoc data | |
| getFatDocOldRevision(name, revision, historyOptions, getOptions) | Get an old revision of a FatDoc data | |
| getHistory(_id, historyOptions) | Get revision history of a document | |
| getOldRevision(_id, revision, historyOptions) | Get an old revision of a document | |
| getRemoteURLs() | getRemoteURLs | |
| getSync(remoteURL) | Get synchronizer | |
| insert(jsonDoc, options) | Insert a JSON document | |
| insert(_id, jsonDoc, options) | Insert a JSON document | |
| insertFatDoc(name, doc, options) | Insert a data | |
| loadAuthor() | Load author from .git/config | |
| offSyncEvent(remoteURL, event, callback) | Remove SyncEvent handler | |
| offSyncEvent(sync, event, callback) | Remove SyncEvent handler | |
| onSyncEvent(remoteURL, event, callback) | Add SyncEvent handler | |
| onSyncEvent(sync, event, callback) | Add SyncEvent handler | |
| open(openOptions) | Open or create a Git repository | |
| plugin(obj) | static | |
| put(jsonDoc, options) | Insert a JSON document if not exists. Otherwise, update it. | |
| put(_id, jsonDoc, options) | Insert a JSON document if not exists. Otherwise, update it. | |
| putFatDoc(name, doc, options) | Insert data if not exists. Otherwise, update it. | |
| removeSync(remoteURL) | Stop and unregister remote synchronization | |
| saveAuthor() | Save current author to .git/config | |
| sync(options) | Synchronize with a remote repository | |
| sync(options, getSyncResult) | Synchronize with a remote repository | |
| update(jsonDoc, options) | Update a JSON document | |
| update(_id, jsonDoc, options) | Update a JSON document | |
| updateFatDoc(name, doc, options) | Update a data |