39 lines
1 KiB
TypeScript
39 lines
1 KiB
TypeScript
|
import { Attribute } from "./db";
|
||
|
import { Handler } from "./defaultHandler";
|
||
|
import { allModifierInput, primaryData, serializeReturn } from "./types";
|
||
|
|
||
|
|
||
|
|
||
|
export abstract class Modifier {
|
||
|
t : string;
|
||
|
a : Array<allModifierInput>;
|
||
|
constructor(type: string, args: (allModifierInput)[]) {
|
||
|
this.t = type;
|
||
|
this.a = args;
|
||
|
}
|
||
|
serialize(handler = Handler):serializeReturn {
|
||
|
return handler.modifiers[this.t as keyof typeof handler.modifiers](this.a);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export class BooleanModifier extends Modifier{}
|
||
|
export class NumberModifier extends Modifier{}
|
||
|
export class StringModifier extends Modifier{}
|
||
|
|
||
|
export class Aggregation{
|
||
|
t : string;
|
||
|
a : Attribute;
|
||
|
constructor(type: string, args: Attribute) {
|
||
|
this.t = type;
|
||
|
this.a = args;
|
||
|
}
|
||
|
serialize(handler = Handler):serializeReturn{
|
||
|
return handler.aggregations[this.t as keyof typeof handler.aggregations](this.a);
|
||
|
}
|
||
|
}
|
||
|
export class Joins{
|
||
|
|
||
|
serialize(handler = Handler):serializeReturn {
|
||
|
return ["",[]];
|
||
|
}
|
||
|
}
|