api_byte_lib.go 1.2 KB
package bytelib

import (
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain/bytecore"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/api"
	"time"
)

// ApiByteLib 字库底层接口
type ApiByteLib struct {
	api.BaseServiceGateway
	baseUrL string
}

func NewApiByteLib(host string) *ApiByteLib {
	gt := api.NewBaseServiceGateway(host)
	gt.ConnectTimeout = 10 * time.Second
	gt.ReadWriteTimeout = 10 * time.Second
	return &ApiByteLib{
		BaseServiceGateway: gt,
	}
}

// 加载数据

func (gateway ApiByteLib) LoadDataTable(param bytecore.ReqLoadDataTable) (*bytecore.DataLoadDataTable, error) {
	return nil, nil
}

// EditTable 编辑表格
func (gateway ApiByteLib) EditTable(param bytecore.ReqEditDataTable) (*bytecore.DataEditDataTable, error) {
	url := gateway.Host() + "/table/edit"
	method := "post"
	var data bytecore.DataEditDataTable
	err := gateway.FastDoRequest(url, method, param, &data)
	if err != nil {
		return nil, err
	}
	return &data, nil
}

// 保存校验文件 (文件地址)

// 生成主表

// 表复制

// 追加数据

// 表删除 (主表、副表、分表)

// 表拆分

// 更新表结构(分表)

// 编辑、添加、删除表数据(副表)