using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 数据表格接口设计
/// </summary>
public interface TableInterface
{
    /// <summary>
    /// 无参打开表格
    /// </summary>
    /// <returns></returns>
    bool Open();
    /// <summary>
    /// 打开数据表
    /// </summary>
    /// <param name="path"></param>
    bool Open(string path);
    /// <summary>
    /// 关闭表
    /// </summary>
    void Close();
    /// <summary>
    /// 保存表
    /// </summary>
    void Save();
    bool Create(string tableName);
    /// <summary>
    /// 向表格添加对象
    /// </summary>
    /// <typeparam name="T">泛型对象</typeparam>
    /// <param name="data">待插入的数据</param>
    /// <returns></returns>
    bool InsertData<T>(T data);
    bool InsertData<T>(T data,string priKey);
    /// <summary>
    /// 查找对象
    /// </summary>
    /// <typeparam name="T">泛型对象</typeparam>
    /// <param name="key">key值</param>
    /// <returns></returns>
    T FindData<T>(string key);
    /// <summary>
    /// 查找所有对象
    /// </summary>
    /// <typeparam name="T">查找的泛型</typeparam>
    /// <returns></returns>
    List<T> FindAllData<T>();
    /// <summary>
    /// 从已有的数据流中读取对象
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="data">数据流</param>
    /// <returns></returns>
    List<T> FindAllData<T>(string data);
    /// <summary>
    /// 从已有的数据流中读取对象
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="data">数据流</param>
    /// <returns></returns>
    List<T> FindAllData<T>(byte[] data);
    /// <summary>
    /// 更新对象
    /// </summary>
    /// <typeparam name="T">泛型对象</typeparam>
    /// <param name="data">待更新的对象</param>
    /// <returns></returns>
    bool UpdateData<T>(T data);
    bool UpdateData<T>(T data,string key);
    /// <summary>
    /// 删除对象
    /// </summary>
    /// <typeparam name="T">泛型对象</typeparam>
    /// <param name="key">待删除的key值</param>
    /// <returns></returns>
    bool DeleteData<T>(string key);
    /// <summary>
    /// 删除指定的所有对象
    /// </summary>
    /// <typeparam name="T">泛型对象</typeparam>
    /// <returns></returns>
    bool DeleteAllData<T>();
}
