27 lines
432 B
Go
27 lines
432 B
Go
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
|
|
}
|