Added general Pipe API

This commit is contained in:
obscuren
2014-08-04 16:25:53 +02:00
parent 03ce15df4c
commit 342cc122b4
6 changed files with 345 additions and 0 deletions

View File

@ -122,6 +122,14 @@ func (val *Value) Bytes() []byte {
return []byte{}
}
func (val *Value) Err() error {
if err, ok := val.Val.(error); ok {
return err
}
return nil
}
func (val *Value) Slice() []interface{} {
if d, ok := val.Val.([]interface{}); ok {
return d
@ -157,6 +165,11 @@ func (val *Value) IsStr() bool {
return val.Type() == reflect.String
}
func (self *Value) IsErr() bool {
_, ok := self.Val.(error)
return ok
}
// Special list checking function. Something is considered
// a list if it's of type []interface{}. The list is usually
// used in conjunction with rlp decoded streams.