aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Sjoding <joshua.sjoding@scjalliance.com>2016-02-26 13:56:39 -0800
committerJoshua Sjoding <joshua.sjoding@scjalliance.com>2016-02-26 13:56:39 -0800
commitff809118743100300c38d0c626ffe8c840fb1275 (patch)
treed4e453951eff5b08863659de332047251f133972
parent1e74b17f05ad27818df39818a0d22107a0b4b424 (diff)
downloadgo-git-ff809118743100300c38d0c626ffe8c840fb1275.tar.gz
Added function to check validity of core.ObjectType
-rw-r--r--core/object.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/object.go b/core/object.go
index d56a44a..7cc8af9 100644
--- a/core/object.go
+++ b/core/object.go
@@ -79,6 +79,11 @@ func (t ObjectType) Bytes() []byte {
return []byte(t.String())
}
+// Valid returns true if t is a valid ObjectType.
+func (t ObjectType) Valid() bool {
+ return t >= CommitObject && t <= REFDeltaObject
+}
+
// ParseObjectType parses a string representation of ObjectType. It returns an
// error on parse failure.
func ParseObjectType(value string) (typ ObjectType, err error) {