func GetByIDs(ids []string, k Kind, opts *Options) (*model.Result, error) {
	objIDs := make([]objectID, len(ids))
	for i, id := range ids {
		objID, err := model.ToObjectID(id)
		if err != nil {
			return &model.Result{}, err
		}
		objIDs[i] = objID
	}
	return getManyByFilter(bson.M{"_id": bson.M{"$in": objIDs}, "_kind": k}, k, opts)
}
GetByIDs returns a result by given IDs
package item
import (
	"context"
	"fmt"
	"regexp"
	"strings"
	"time"
	"github.com/tarkov-database/rest-api/core/database"
	"github.com/tarkov-database/rest-api/model"
	"github.com/google/logger"
	"go.mongodb.org/mongo-driver/bson"
	"go.mongodb.org/mongo-driver/bson/primitive"
	"go.mongodb.org/mongo-driver/mongo"
	"go.mongodb.org/mongo-driver/mongo/options"
)
const Collection = "items"
func getOneByFilter(filter interface{}, k Kind) (Entity, error) {
	c := database.GetDB().Collection(Collection)
	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
	defer cancel()
	e, err := k.GetEntity()
	if err != nil {
		return e, err
	}
	if err = c.FindOne(ctx, filter).Decode(e); err != nil {
		if err != mongo.ErrNoDocuments {
			logger.Error(err)
		}
		return e, model.MongoToAPIError(err)
	}
	return e, nil
}
func GetByID(id string, k Kind) (Entity, error) {
	objID, err := model.ToObjectID(id)
	if err != nil {
		return nil, err
	}
	return getOneByFilter(bson.M{"_id": objID, "_kind": k}, k)
}
type Options struct {
	Sort   map[string]int64
	Limit  int64
	Offset int64
}
func getManyByFilter(filter interface{}, k Kind, opts *Options) (*model.Result, error) {
	c := database.GetDB().Collection(Collection)
	findOpts := options.Find()
	findOpts.SetLimit(opts.Limit)
	findOpts.SetSkip(opts.Offset)
	findOpts.SetSort(opts.Sort)
	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
	defer cancel()
	var err error
	r := &model.Result{}
	r.Count, err = c.CountDocuments(ctx, filter)
	if err != nil {
		logger.Error(err)
		return r, model.MongoToAPIError(err)
	}
	if r.Count == 0 {
		return r, nil
	}
	cur, err := c.Find(ctx, filter, findOpts)
	if err != nil {
		if err != mongo.ErrNoDocuments {
			logger.Error(err)
		}
		return r, model.MongoToAPIError(err)
	}
	defer cur.Close(ctx)
	for cur.Next(ctx) {
		e, err := k.GetEntity()
		if err != nil {
			return r, err
		}
		if err := cur.Decode(e); err != nil {
			logger.Error(err)
			return r, model.MongoToAPIError(err)
		}
		r.Items = append(r.Items, e)
	}
	if err := cur.Err(); err != nil {
		logger.Error(err)
		return r, model.MongoToAPIError(err)
	}
	return r, nil
}
func GetAll(filter map[string]interface{}, k Kind, opts *Options) (*model.Result, error) {
	filter["_kind"] = k
	return getManyByFilter(filter, k, opts)
}