Skip to content

ISourceWrapper

Qamsari edited this page Aug 21, 2021 · 2 revisions

This interface expose some source related helper methods.

export default interface ISourceWrapper {
  sortAsync(source: ISource, sort: string, context: IContext): Promise<ISource>;

  filterAsync(
    source: ISource,
    filter: string,
    context: IContext
  ): Promise<any[]>;

  isNullOrEmpty(data: string): boolean;

  runSqlAsync(
    source: ISource,
    sql: string,
    context: IContext
  ): Promise<ISource>;

  data(id: SourceId, data: any, options?: ISourceOptions): Data;
  new (id: SourceId, data: any, options?: ISourceOptions): ISource;
}

Methods

  • sortAsync(source,sort,context)
    Apply sort as SQL order clauses over the source and return objects as new array. this method use dbLib for execute query.

    • source
      source as ISource object.

    • sort
      string that present SQL order clauses.

    • context
      IContext that represent current rendering context.

  • filterAsync(source,filter,context) Apply filter as SQL where clauses over the source and return objects as new array. this method use dbLib for execute query.

    • source
      source as ISource object.

    • filter
      string that present SQL where clauses.

    • context
      IContext that represent current rendering context.

  • runSqlAsync(source,sql,context) Apply sql as SQL query over the source and return objects as new array. this method use dbLib for execute query.

    • source
      source as ISource object.

    • sql
      string that present SQL query.

    • context
      IContext that represent current rendering context.

  • data(id,data,options)
    Create Data object from input parameters

    • id
      Name of new Data object.

    • data
      Data that present with new Data object.

    • options
      object of type ISourceOptions, that determine options for new Data object.

  • new(id,data,options)
    Create ISource object from input parameters

Clone this wiki locally