Skip to content
Snippets Groups Projects
Select Git revision
  • develop default protected
  • simmc-based
  • drill-experiment
  • tg-felipe
  • issue/97
  • issue/63
  • icde-2019-experiments
  • issue/85
  • master protected
  • issue/20
  • refactor/engine
  • issue/6
  • feature/diagrams
  • wip-transformers
14 results

adapter.ts

Blame
  • adapter.ts 1.92 KiB
    /*
     * Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre
     * Departamento de Informatica - Universidade Federal do Parana
     *
     * This file is part of blend.
     *
     * blend is free software: you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * (at your option) any later version.
     *
     * blend is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with blend.  If not, see <http://www.gnu.org/licenses/>.
     */
    
    import { View } from "./view";
    import { Source } from "./source";
    
    /**
     * Absraction of the SGBD from the BlenDB perspective. Used to
     * perform all the operations into the database that the Blendb
     * requires. This operations include read and write data.
     */
    export abstract class Adapter {
        /**
         * Asynchronously reads all data from given view.
         * In other words perform a SELECT query.
         * @param view - "Location" from all data should be read.
         * @param cb - Callback function which contains the data read.
         * @param cb.error - Error information when the method fails.
         * @param cb.result - Data got from view.
         */
        public abstract getDataFromView(view: View, cb: (err: Error, result: any[]) =>  void): void;
        /**
         * Asynchronously insert one register into a given Source.
         * @param source - Insertion "location".
         * @param cb - Callback function which contains the query result.
         * @param cb.error - Error information when the method fails.
         * @param cb.result - Query result.
         */
        public abstract insertIntoSource(source: Source, data: any[], cb: (err: Error, result: any[]) =>  void): void;
    }