All files / src/cds/expressions cds_define_table_function.ts

100% Statements 18/18
100% Branches 1/1
100% Functions 1/1
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 181x 1x 1x 1x 1x 1x 1x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 1x
import {CDSAnnotation, CDSType, CDSWithParameters} from ".";
import {Expression, seq, star, opt, str, plus, optPrio} from "../../abap/2_statements/combi";
import {IStatementRunnable} from "../../abap/2_statements/statement_runnable";
import {CDSName} from "./cds_name";
 
export class CDSDefineTableFunction extends Expression {
  public getRunnable(): IStatementRunnable {
    const methodName = seq(CDSName, "=", ">", CDSName);
 
    return seq(star(CDSAnnotation),
               str("DEFINE TABLE FUNCTION"),
               CDSName,
               optPrio(CDSWithParameters),
               str("RETURNS {"),
               plus(seq(optPrio("KEY"), CDSName, ":", CDSType, ";")),
               str("} IMPLEMENTED BY METHOD"), methodName, opt(";"));
  }
}