Files
openbilibili/app/service/main/dapper-query/dao/util.go

19 lines
461 B
Go
Raw Normal View History

2019-04-22 20:46:32 +08:00
package dao
import (
"fmt"
"strconv"
"github.com/dgryski/go-farm"
)
func rangeKey(prefix string, start, end int64) (string, string) {
return prefix + strconv.FormatInt(start, 10), prefix + strconv.FormatInt(end, 10)
}
func keyPrefix(serviceName, operationName string) string {
serviceNameHash := farm.Hash32([]byte(serviceName))
operationNameHash := farm.Hash32([]byte(operationName))
return fmt.Sprintf("%x%x", serviceNameHash, operationNameHash)
}