diff --git a/mapper.go b/mapper.go index 7ef4ed8..b740ba3 100644 --- a/mapper.go +++ b/mapper.go @@ -86,3 +86,27 @@ func ExtractSelect(prop notionapi.Property) string { } return "" } + +func ExtractFormula(prop notionapi.Property) notionapi.Formula { + if form, ok := prop.(*notionapi.FormulaProperty); ok { + return form.Formula + } + + return notionapi.Formula{} +} + +func ExtractFormulaText(prop notionapi.Property) string { + return ExtractFormula(prop).String +} + +func ExtractFormulaBool(prop notionapi.Property) bool { + return ExtractFormula(prop).Boolean +} + +func ExtractFormulaNumber(prop notionapi.Property) float64 { + return ExtractFormula(prop).Number +} + +func ExtractFormulaDate(prop notionapi.Property) notionapi.DateObject { + return *ExtractFormula(prop).Date +}