Files
go-common/app/service/main/dapper-query/dao/util.go
2019-04-22 18:49:16 +08:00

19 lines
461 B
Go

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)
}