diff options
Diffstat (limited to 'model/run.go')
| -rw-r--r-- | model/run.go | 24 |
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 +} |
