summaryrefslogtreecommitdiff
path: root/model/run.go
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-05-22 16:54:49 +0200
committerewy <ewy0@protonmail.com>2026-05-22 16:54:49 +0200
commit007e2de369f9fc26da3237646de14f2af5052ee8 (patch)
treef81557385628fc93f1ef9616b8bc75a304f9d740 /model/run.go
initial commit
Diffstat (limited to 'model/run.go')
-rw-r--r--model/run.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/model/run.go b/model/run.go
new file mode 100644
index 0000000..9329708
--- /dev/null
+++ b/model/run.go
@@ -0,0 +1,24 @@
+package model
+
+import (
+ "crypto/md5"
+ "encoding/hex"
+ "encoding/json"
+)
+
+type Run struct {
+ RunSave
+ RunId string
+}
+
+func NewRun(fileContent []byte) (Run, error) {
+ var save RunSave
+ err := json.Unmarshal(fileContent, &save)
+ sum := md5.Sum(fileContent)
+ r := Run{RunId: hex.EncodeToString(sum[:]), RunSave: save}
+ if err != nil {
+ return r, err
+ }
+
+ return r, nil
+}