mirror of
https://github.com/PretendoNetwork/friends.git
synced 2026-04-24 14:56:52 -05:00
27 lines
525 B
Go
27 lines
525 B
Go
package database
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/PretendoNetwork/friends-secure/globals"
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
"go.mongodb.org/mongo-driver/mongo/options"
|
|
)
|
|
|
|
func GetUserInfoByPID(pid uint32) bson.M {
|
|
var result bson.M
|
|
|
|
err := mongoCollection.FindOne(context.TODO(), bson.D{{Key: "pid", Value: pid}}, options.FindOne()).Decode(&result)
|
|
|
|
if err != nil {
|
|
if err == mongo.ErrNoDocuments {
|
|
return nil
|
|
}
|
|
|
|
globals.Logger.Critical(err.Error())
|
|
}
|
|
|
|
return result
|
|
}
|