2024-12-04 17:27:49 -08:00
|
|
|
package model
|
|
|
|
|
2024-12-17 15:57:29 -08:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/dchest/siphash"
|
|
|
|
)
|
|
|
|
|
|
|
|
func HashSource(source string) uint64{
|
|
|
|
return siphash.Hash(0, 0, []byte(source))
|
|
|
|
}
|
|
|
|
|
|
|
|
func HashFormat(hash uint64) string{
|
|
|
|
return fmt.Sprintf("%016x", hash)
|
|
|
|
}
|
2024-12-09 22:27:52 -08:00
|
|
|
|
2024-12-04 17:27:49 -08:00
|
|
|
type Script struct {
|
2024-12-12 17:29:20 -05:00
|
|
|
ID int64 `gorm:"primaryKey"`
|
2024-12-14 12:31:31 -08:00
|
|
|
Name string
|
2024-12-12 17:29:20 -05:00
|
|
|
Hash uint64
|
|
|
|
Source string
|
|
|
|
SubmissionID int64 // which submission did this script first appear in
|
|
|
|
CreatedAt time.Time
|
|
|
|
UpdatedAt time.Time
|
2024-12-04 17:27:49 -08:00
|
|
|
}
|