All files / src/lib/database index.ts

0% Statements 0/106
100% Branches 0/0
0% Functions 0/1
0% Lines 0/106

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107                                                                                                                                                                                                                     
/**
 * Database Utilities Index
 *
 * Exports all database optimization utilities for easy imports
 */

// Metrics and monitoring
export {
  trackSlowQuery,
  getQueryMetrics,
  getMetricsSummary,
  clearMetrics,
  QUERY_THRESHOLDS,
  type QueryMetric,
} from './metrics';

export {
  recordQueryTiming,
  getQueryStats,
  getSlowQueries,
  clearQueryHistory,
  createQueryTimingMiddleware,
  timedQuery,
  checkQueryHealth,
  QUERY_TIMING_THRESHOLDS,
  type QueryTiming,
  type QueryStats,
} from './monitor';

// Pagination
export {
  cursorPaginate,
  type CursorPaginationParams,
  type CursorPaginationResult,
} from './pagination';

// Batch operations
export {
  batchUpdate,
  batchDelete,
  batchUpsert,
  type BatchResult,
} from './batch';

// DataLoaders
export {
  createCategoryLoader,
  createReviewCountLoader,
  createReviewAverageLoader,
  createProductLoader,
  loadProductsWithStats,
  loadUserOrderStats,
  loadCategoryTree,
} from './dataLoaders';

// Standardized select configurations
export {
  // Product selects
  productListSelect,
  productCardSelect,
  productDetailSelect,
  productAdminSelect,
  // User selects
  userProfileSelect,
  userWithAddressesSelect,
  userAdminSelect,
  // Order selects
  orderSummarySelect,
  orderDetailSelect,
  orderAdminSelect,
  // Category selects
  categoryNavSelect,
  categoryWithCountSelect,
  categoryTreeSelect,
  // Review selects
  reviewDisplaySelect,
  reviewAdminSelect,
  // Types
  type ProductListItem,
  type ProductCardItem,
  type ProductDetail,
  type UserProfile,
  type OrderSummary,
  type OrderDetail,
  type CategoryNav,
  type ReviewDisplay,
} from './selects';

// Query caching
export {
  getCachedCategories,
  getCachedCategoriesWithCounts,
  getCachedCategoryBySlug,
  getCachedDiscountedProducts,
  getCachedProductById,
  getCachedProductsByCategory,
  getCachedNewArrivals,
  getCachedInStockProducts,
  getCachedReviewStats,
  invalidateProductCache,
  invalidateCategoryCache,
  invalidateReviewCache,
  invalidateAllCaches,
  CACHE_DURATIONS,
  CACHE_TAGS,
} from './cache';