add IsEmpty function for gdb.Record/Result

This commit is contained in:
John
2019-12-04 17:01:30 +08:00
parent eac60d845f
commit 3cc9ce74e1
2 changed files with 10 additions and 0 deletions

View File

@ -46,3 +46,8 @@ func (r Record) Struct(pointer interface{}) error {
}
return mapToStruct(r.Map(), pointer)
}
// IsEmpty checks and returns whether <r> is empty.
func (r Record) IsEmpty() bool {
return len(r) == 0
}

View File

@ -131,3 +131,8 @@ func (r Result) Structs(pointer interface{}) (err error) {
reflect.ValueOf(pointer).Elem().Set(array)
return nil
}
// IsEmpty checks and returns whether <r> is empty.
func (r Result) IsEmpty() bool {
return len(r) == 0
}