MCPcopy Create free account
hub / github.com/bytebase/bytebase / getDefaultValue

Function getDefaultValue

frontend/src/react/components/ExprEditor.tsx:78–88  ·  view source on GitHub ↗
(
  factor: Factor,
  operator?: ConditionOperator
)

Source from the content-addressed store, hash-verified

76}
77
78function getDefaultValue(
79 factor: Factor,
80 operator?: ConditionOperator
81): string | number | boolean | Date | string[] | number[] {
82 if (operator && isCollectionOperator(operator)) return [];
83 if (isNumberFactor(factor)) return 0;
84 if (isBooleanFactor(factor)) return true;
85 if (isStringFactor(factor)) return "";
86 if (isTimestampFactor(factor)) return new Date();
87 return "";
88}
89
90const VALUE_MULTI_FIELD_CLASS =
91 "min-h-9 px-3 py-1 text-sm leading-5 rounded-xs border border-control-border bg-background";

Callers 3

FactorSelectFunction · 0.85
OperatorSelectFunction · 0.85
addConditionFunction · 0.85

Calls 5

isCollectionOperatorFunction · 0.90
isNumberFactorFunction · 0.90
isBooleanFactorFunction · 0.90
isStringFactorFunction · 0.90
isTimestampFactorFunction · 0.90

Tested by

no test coverage detected