2021-01-19 22:05:46 +08:00
|
|
|
package db
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
2023-06-30 18:08:30 +08:00
|
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
2021-01-19 22:05:46 +08:00
|
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type TruncateTableAction struct {
|
|
|
|
|
actionutils.ParentAction
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *TruncateTableAction) RunPost(params struct {
|
|
|
|
|
NodeId int64
|
|
|
|
|
Table string
|
|
|
|
|
}) {
|
2023-06-30 18:08:30 +08:00
|
|
|
defer this.CreateLogInfo(codes.DBNode_LogTruncateTable, params.NodeId, params.Table)
|
2021-01-19 22:05:46 +08:00
|
|
|
|
|
|
|
|
_, err := this.RPC().DBNodeRPC().TruncateDBNodeTable(this.AdminContext(), &pb.TruncateDBNodeTableRequest{
|
|
|
|
|
DbNodeId: params.NodeId,
|
|
|
|
|
DbNodeTable: params.Table,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
this.ErrorPage(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.Success()
|
|
|
|
|
}
|