aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-05-29 15:23:15 +0100
committerMatthew Lemon <y@yulqen.org>2024-05-29 15:23:15 +0100
commitb77dec0049ea1d23fc75e73866f2bdf305ad3433 (patch)
tree9ea69770a3149ae352285014aec8dc0a4932841c
parent00c3d5dac0545133831f41ea6692aa53d8eb4cde (diff)
Some tidying
-rw-r--r--cmd/dbasik-api/return.go33
1 files changed, 16 insertions, 17 deletions
diff --git a/cmd/dbasik-api/return.go b/cmd/dbasik-api/return.go
index 2fa6793..3320980 100644
--- a/cmd/dbasik-api/return.go
+++ b/cmd/dbasik-api/return.go
@@ -7,6 +7,18 @@ import (
"path/filepath"
)
+type FilePreparer interface {
+ Prepare() ([]string, error)
+}
+
+type FileSource struct {
+ FilePath string
+}
+
+type DirectoryFilePackage struct {
+ FileSource
+}
+
type ReturnLine struct {
Sheet string
CellRef string
@@ -18,6 +30,10 @@ type Return struct {
ReturnLines []ReturnLine
}
+type ZipFilePackage struct {
+ FileSource
+}
+
// NewReturnLine creates a new ReturnLine object
func NewReturnLine(sheet, cellRef, value string) (*ReturnLine, error) {
if err := validateInputs(sheet, cellRef, value); err != nil {
@@ -106,7 +122,6 @@ func ParseXLSX(filePath string, dm *Datamap) (*Return, error) {
return rtn, nil
}
-// contains checks if a slice contains a given string
func contains(slice []string, str string) bool {
for _, s := range slice {
if s == str {
@@ -116,18 +131,6 @@ func contains(slice []string, str string) bool {
return false
}
-type FilePreparer interface {
- Prepare() ([]string, error)
-}
-
-type FileSource struct {
- FilePath string
-}
-
-type DirectoryFilePackage struct {
- FileSource
-}
-
func PrepareFiles(fp FilePreparer) ([]string, error) {
ch := make(chan string, 100)
@@ -159,10 +162,6 @@ func (fp *DirectoryFilePackage) Prepare() ([]string, error) {
return files, nil
}
-type ZipFilePackage struct {
- FileSource
-}
-
func (fp *ZipFilePackage) Prepare() ([]string, error) {
files, err := zip.OpenReader(fp.FilePath)
if err != nil {