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.
17 lines
346 B
17 lines
346 B
12 months ago
|
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
|
||
|
}
|