mirror of
https://github.com/mainnika/mongox-go-driver.git
synced 2026-05-23 00:03:36 +00:00
Prepare for v3
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user