UNPKG

livia-titan

Version:

Titan adapter for universal database driver Livia

23 lines (18 loc) 449 B
import { Schema } from 'livia'; function getDefaultClassName() { return this._className; } export function prepareSchema(schema) { schema.virtual('_id', { metadata: true }).get(function() { return this.get('id'); }); }; export default class TitanSchema extends Schema { constructor(props, options) { super(props, options); prepareSchema(this); } getSubdocumentSchemaConstructor() { return TitanSchema; } };