Files
checky/object.go

18 lines
302 B
Go
Raw Normal View History

2022-03-15 04:52:43 +00:00
package main
2022-03-15 16:27:52 +00:00
import "encoding/hex"
2022-03-15 04:52:43 +00:00
import "fmt"
type Object interface {
2022-03-15 16:27:52 +00:00
GetType() string
GetId() string
}
func ObjectSafeId(obj Object) string {
return hex.EncodeToString([]byte(obj.GetId()))
2022-03-15 04:52:43 +00:00
}
func ObjectKey(obj Object) string {
2022-03-15 16:27:52 +00:00
return fmt.Sprintf("%s:%s", obj.GetType(), ObjectSafeId(obj))
2022-03-15 04:52:43 +00:00
}