env3d.go 458 B

12345678910111213141516171819202122
  1. package repo
  2. import (
  3. "mats/db/model"
  4. "go.mongodb.org/mongo-driver/bson/primitive"
  5. )
  6. func Env3dGetById(ctx *RepoSession, id string, project []string) *model.Env3d {
  7. eid, _ := primitive.ObjectIDFromHex(id)
  8. option := DocSearchOptions{
  9. CollectName: CollectionEvn3d,
  10. Query: Map{"_id": eid},
  11. Project: project,
  12. }
  13. env3d := &model.Env3d{}
  14. ok, err := RepoSeachDoc(ctx, &option, env3d)
  15. if err != nil || !ok {
  16. return nil
  17. }
  18. return env3d
  19. }