26 lines
748 B
Go
26 lines
748 B
Go
package hasher
|
|
|
|
import (
|
|
"git.andreafazzi.eu/andrea/probo/client"
|
|
)
|
|
|
|
type HashFunc func(string) string
|
|
|
|
type Hasher interface {
|
|
// Hash returns a slice of hashes. The first one is an
|
|
// hash calculated from the question using
|
|
// QuestionHash. Following hashes are calculated from the
|
|
// answers using AnswerHash.
|
|
QuizHashes(quiz *client.CreateQuizRequest) []string
|
|
|
|
// QuestionHash returns an hash calculated from a field of
|
|
// Question struct.
|
|
QuestionHash(question *client.CreateQuestionRequest) string
|
|
|
|
// AnswerHash returns an hash calculated from a field of
|
|
// Answer struct.
|
|
AnswerHash(answer *client.CreateAnswerRequest) string
|
|
|
|
// Calculate calculates a checksum from all the given hashes.
|
|
Calculate(hashes []string) string
|
|
}
|