type-arango
Version:
ArangoDB Foxx decorators and utilities for TypeScript
57 lines (56 loc) • 1.69 kB
TypeScript
/// <reference types="arangodb" />
import { Document } from '.';
import { DocumentData } from '../types';
interface SaveOptions extends ArangoDB.UpdateOptions, ArangoDB.InsertOptions {
update: boolean;
}
export declare class Entity {
_collection: ArangoDB.Collection;
_saveKeys: string[];
_id?: string;
_key?: string;
_rev?: string;
_from?: string | any;
_to?: string | any;
[key: string]: any;
static get _doc(): Document<Entity>;
static get _db(): any;
get _doc(): Document<any>;
static get _relations(): string[];
constructor(doc?: DocumentData | string, isSync?: boolean);
/**
* Returns related entity
*/
related(attribute: string, attributes?: string[]): any;
/**
* Creates the document by using .save({update:false})
*/
insert(): this;
/**
* Alias for insert
* @deprecated
*/
create(): this;
/**
* Merges `obj` into `this`
*/
merge(...obj: DocumentData[]): any;
/**
* Converts entity to object (strips property listeners)
*/
toObject(): {} & this;
/**
* Saves changed attributes to database. Creates a new document when no _key is available.
* Use the option {update:false} to always create a new document even when a _key is provided.
*/
save(options?: Partial<SaveOptions>): this;
/**
* Replaces the document with the provided doc, ignoring _saveKeys
*/
replace(doc: DocumentData, options?: ArangoDB.ReplaceOptions): any;
/**
* Removes the document
*/
remove(options?: ArangoDB.RemoveOptions): any;
}
export {};