mirror of
https://gitee.com/johng/gf
synced 2026-07-04 21:03:13 +08:00
add IsEmpty function for gdb.Record/Result
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user