All files / src/types result.types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

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 108 109 110 111                                                                                                                                                                                                                             
/**
 * 分页结果类型定义
 */
 
/**
 * 分页结果
 *
 * 包含分页数据和分页信息的完整结果
 *
 * @typeParam T - 数据项类型
 */
export type PaginatedResult<T> = {
  /**
   * 数据项数组
   */
  items: T[];
 
  /**
   * 总记录数
   */
  total: number;
 
  /**
   * 当前页码
   */
  page: number;
 
  /**
   * 每页数量
   */
  pageSize: number;
 
  /**
   * 总页数
   */
  totalPages: number;
 
  /**
   * 是否有下一页
   */
  hasNextPage: boolean;
 
  /**
   * 是否有上一页
   */
  hasPreviousPage: boolean;
};
 
/**
 * Offset 风格分页结果
 *
 * 包含偏移量分页数据和分页信息
 *
 * @typeParam T - 数据项类型
 */
export type OffsetPaginatedResult<T> = {
  /**
   * 数据项数组
   */
  items: T[];
 
  /**
   * 总记录数
   */
  total: number;
 
  /**
   * 限制数量
   */
  limit: number;
 
  /**
   * 偏移量
   */
  offset: number;
 
  /**
   * 是否有更多数据
   */
  hasMore: boolean;
};
 
/**
 * 游标分页结果
 *
 * 包含游标分页数据和分页信息
 *
 * @typeParam T - 数据项类型
 */
export type CursorPaginatedResult<T> = {
  /**
   * 数据项数组
   */
  items: T[];
 
  /**
   * 下一页游标
   */
  nextCursor: string | null;
 
  /**
   * 上一页游标
   */
  previousCursor: string | null;
 
  /**
   * 是否有更多数据
   */
  hasMore: boolean;
};