first prototype
This commit is contained in:
26
csv/main.go
Normal file
26
csv/main.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package csv
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Plan struct {
|
||||
Menus [3][7]string
|
||||
}
|
||||
|
||||
func Load() (Plan, error) {
|
||||
f, err := os.ReadFile("./plan.csv")
|
||||
if err != nil {
|
||||
return Plan{}, err
|
||||
}
|
||||
var menus [3][7]string
|
||||
records, err := csv.NewReader(strings.NewReader(string(f))).ReadAll()
|
||||
for y := 0; y <= 2; y++ {
|
||||
for x := 0; x <= 6; x++ {
|
||||
menus[y][x] = records[y+1][x+1]
|
||||
}
|
||||
}
|
||||
return Plan{Menus: menus}, err
|
||||
}
|
||||
Reference in New Issue
Block a user