aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/dbasik-api/helpers.go
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-04-19 20:51:48 +0100
committerMatthew Lemon <y@yulqen.org>2024-04-19 20:51:48 +0100
commit04f78ef7a46ae4c4b8ab49153c16983c590783f5 (patch)
tree77825f91fb6175f300c2667be4c9a91b19aab417 /cmd/dbasik-api/helpers.go
parent85d77655a515c120e5c0ba3c48c6be4eda1ac8f6 (diff)
First parse of an Excel file
Diffstat (limited to 'cmd/dbasik-api/helpers.go')
-rw-r--r--cmd/dbasik-api/helpers.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmd/dbasik-api/helpers.go b/cmd/dbasik-api/helpers.go
index 3b07dc2..68d9f66 100644
--- a/cmd/dbasik-api/helpers.go
+++ b/cmd/dbasik-api/helpers.go
@@ -20,9 +20,19 @@ package main
import (
"encoding/json"
"net/http"
+ "regexp"
)
-// We want this so that our JSON is nested under a key at the top, e.g. "datamap:"...
+// validateSpreadsheetCell checks that the cellRef is in a valid format
+func validateSpreadsheetCell(cellRef string) bool {
+ pattern := `^[A-Z]+[1-9][0-9]*$`
+
+ regExp := regexp.MustCompile(pattern)
+
+ return regExp.MatchString(cellRef)
+}
+
+// We want this so that our JSON is nested under a key at the top, e.g. "Datamap:"...
type envelope map[string]interface{}
// writeJSON)Pretty() helper for sending responses - pretty prints output. This takes the destination http.ResponseWriter, the