You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
mongox-go-driver/mongox/base/ifacebased/id.go

16 lines
346 B

package ifacebased
import (
"github.com/mainnika/mongox-go-driver/v2/mongox"
"github.com/modern-go/reflect2"
)
// GetID returns an _id from the source document
func GetID(source mongox.InterfaceBased) (id interface{}, err error) {
id = source.GetID()
if !reflect2.IsNil(id) {
return id, nil
}
return nil, mongox.ErrUninitializedBase
}