domain_service.go 3.2 KB
package domain

type FileTableService interface {
	Preview(ctx *Context, fileId int, fields []*Field, where Where) (interface{}, error)
	Edit()
	Flush(ctx *Context, fileId int, table *Table) (interface{}, error)
	DeleteFiles(ctx *Context, files ...*File) error
	GenerateTable(ctx *Context, fileId int, tableName string) (interface{}, error)
}

type TableService interface {
	Preview(ctx *Context, tableId int, where Where) (interface{}, error)
	CopyTable(ctx *Context, tableId int, tableName string) (interface{}, error)
	DeleteTables(ctx *Context, tables ...*Table) error
	AppendData(ctx *Context, fileId int, tableId int, mappingFields []*MappingField) (interface{}, error)
	UpdateTableStruct(ctx *Context, tableId int, fields []*Field, name string) (interface{}, error)
	AddTableStruct(ctx *Context, parentTableId int, fields []*Field, name string) (interface{}, error)
}

type PreviewDataTableService interface {
	Preview(ctx *Context, fileId int, fields []*Field, where Where) (interface{}, error)
	RePreview(ctx *Context, fileId int, fields []*Field, where Where) (interface{}, error)
	CreateTemporaryFile(ctx *Context, fileId int) (*File, error)
	GetFileId() int
}

type EditDataTableService interface {
	Edit(ctx *Context, param EditTableRequest) (*DataEditDataTable, error)
}

type FlushDataTableService interface {
	Flush(ctx *Context, fileId int, table *Table) (interface{}, error)
}

type DeleteFileService interface {
	DeleteFiles(ctx *Context, files ...*File) error
}

type GenerateMainTableService interface {
	GenerateTable(ctx *Context, fileId int, tableName string) (interface{}, error)
}

type CopyDataTableService interface {
	CopyTable(ctx *Context, tableId int, tableName string) (interface{}, error)
}

type DeleteDataTableService interface {
	DeleteTable(ctx *Context, tableId int) (interface{}, error)
	DeleteTables(ctx *Context, tables ...*Table) error
}

type AppendDataToTableService interface {
	AppendData(ctx *Context, fileId int, tableId int, mappingFields []*MappingField) (interface{}, error)
	PreflightCheck(ctx *Context, fileId int, tableId int, mappingFields []*MappingField) (interface{}, error)
}

/************************************/

type UpdateTableStructService interface {
	UpdateTableStruct(ctx *Context, tableId int, fields []*Field, name string) (interface{}, error)
}

type AddTableStructService interface {
	AddTableStruct(ctx *Context, parentTableId int, fields []*Field, name string) (*Table, error)
}

type EditTableRequest struct {
	FileId            int                    `json:"objectId"`
	Fields            []*Field               `json:"fields"`
	ProcessFieldNames []string               `json:"processFields"`
	ProcessFields     []*Field               `json:"-" `
	Where             Where                  `json:"where"`
	Action            string                 `json:"action"`
	Params            map[string]interface{} `json:"params"`
}

type TableEditDataService interface {
	RowEdit(ctx *Context, request EditDataRequest) (interface{}, error)
}
type EditDataRequest struct {
	TableId    int `json:"tableId"`
	Table      *Table
	UpdateList []*FieldValues `json:"updateList"`
	RemoveList []*FieldValues `json:"removeList"`
	AddList    []*FieldValues `json:"addList"`
	Where      Where          `json:"where"`
}