TableInterface.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. /// <summary>
  5. /// 数据表格接口设计
  6. /// </summary>
  7. public interface TableInterface
  8. {
  9. /// <summary>
  10. /// 无参打开表格
  11. /// </summary>
  12. /// <returns></returns>
  13. bool Open();
  14. /// <summary>
  15. /// 打开数据表
  16. /// </summary>
  17. /// <param name="path"></param>
  18. bool Open(string path);
  19. /// <summary>
  20. /// 关闭表
  21. /// </summary>
  22. void Close();
  23. /// <summary>
  24. /// 保存表
  25. /// </summary>
  26. void Save();
  27. bool Create(string tableName);
  28. /// <summary>
  29. /// 向表格添加对象
  30. /// </summary>
  31. /// <typeparam name="T">泛型对象</typeparam>
  32. /// <param name="data">待插入的数据</param>
  33. /// <returns></returns>
  34. bool InsertData<T>(T data);
  35. bool InsertData<T>(T data,string priKey);
  36. /// <summary>
  37. /// 查找对象
  38. /// </summary>
  39. /// <typeparam name="T">泛型对象</typeparam>
  40. /// <param name="key">key值</param>
  41. /// <returns></returns>
  42. T FindData<T>(string key);
  43. /// <summary>
  44. /// 查找所有对象
  45. /// </summary>
  46. /// <typeparam name="T">查找的泛型</typeparam>
  47. /// <returns></returns>
  48. List<T> FindAllData<T>();
  49. /// <summary>
  50. /// 从已有的数据流中读取对象
  51. /// </summary>
  52. /// <typeparam name="T"></typeparam>
  53. /// <param name="data">数据流</param>
  54. /// <returns></returns>
  55. List<T> FindAllData<T>(string data);
  56. /// <summary>
  57. /// 从已有的数据流中读取对象
  58. /// </summary>
  59. /// <typeparam name="T"></typeparam>
  60. /// <param name="data">数据流</param>
  61. /// <returns></returns>
  62. List<T> FindAllData<T>(byte[] data);
  63. /// <summary>
  64. /// 更新对象
  65. /// </summary>
  66. /// <typeparam name="T">泛型对象</typeparam>
  67. /// <param name="data">待更新的对象</param>
  68. /// <returns></returns>
  69. bool UpdateData<T>(T data);
  70. bool UpdateData<T>(T data,string key);
  71. /// <summary>
  72. /// 删除对象
  73. /// </summary>
  74. /// <typeparam name="T">泛型对象</typeparam>
  75. /// <param name="key">待删除的key值</param>
  76. /// <returns></returns>
  77. bool DeleteData<T>(string key);
  78. /// <summary>
  79. /// 删除指定的所有对象
  80. /// </summary>
  81. /// <typeparam name="T">泛型对象</typeparam>
  82. /// <returns></returns>
  83. bool DeleteAllData<T>();
  84. }