pgraph: Move get/set state methods out to resource package

This commit is contained in:
James Shubin
2017-05-15 12:06:45 -04:00
parent 11c3a26c23
commit b1e035f96a
3 changed files with 85 additions and 36 deletions

View File

@@ -25,3 +25,12 @@ func Bool(x interface{}) bool {
}
return b
}
// Uint returns the interface value if it is a uint, and otherwise it panics.
func Uint(x interface{}) uint {
u, ok := x.(uint)
if !ok {
panic("not a uint")
}
return u
}