diff --git a/database/gdb/gdb_type_record.go b/database/gdb/gdb_type_record.go index df5487363..f24458914 100644 --- a/database/gdb/gdb_type_record.go +++ b/database/gdb/gdb_type_record.go @@ -46,3 +46,8 @@ func (r Record) Struct(pointer interface{}) error { } return mapToStruct(r.Map(), pointer) } + +// IsEmpty checks and returns whether is empty. +func (r Record) IsEmpty() bool { + return len(r) == 0 +} diff --git a/database/gdb/gdb_type_result.go b/database/gdb/gdb_type_result.go index bb3a42e0a..41d852012 100644 --- a/database/gdb/gdb_type_result.go +++ b/database/gdb/gdb_type_result.go @@ -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 is empty. +func (r Result) IsEmpty() bool { + return len(r) == 0 +}