Initial commit

This commit is contained in:
2023-03-26 16:11:00 +03:00
commit 92469fa3a2
47 changed files with 5610 additions and 0 deletions

39
entity/result.go Normal file
View File

@@ -0,0 +1,39 @@
package entity
import (
"sync"
"github.com/vmihailenco/msgpack/v5"
)
type Result struct {
Format Format
Err error
Files []File
}
type Results struct {
mu sync.RWMutex
results []Result
}
func (r *Results) MarshalMsgpack() ([]byte, error) {
return msgpack.Marshal(r.results)
}
func (r *Results) UnmarshalMsgpack(b []byte) error {
return msgpack.Unmarshal(b, r.results)
}
func (r *Results) Add(result Result) {
r.mu.Lock()
r.results = append(r.results, result)
r.mu.Unlock()
}
func (r *Results) Results() []Result {
r.mu.RLock()
defer r.mu.RUnlock()
return r.results
}