biz

package
v0.0.0-...-6a40476 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 32 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

func ProtoJsonCopy

func ProtoJsonCopy(src proto.Message, dst interface{}) error

Types

type AppRepo

type AppRepo interface {
	GetAppInfoByAppId(ctx context.Context, req *appvo.GetAppInfoByAppIdReq) (*appvo.GetAppInfoByAppIdResp, error)
	// GetRealAppInfoByAppId 如果是镜像id,则会请求真正的id
	GetRealAppInfoByAppId(ctx context.Context, req *appvo.GetAppInfoByAppIdReq) (*appvo.GetAppInfoByAppIdResp, error)
	// GetAppList 通过orgId获取app应用列表,type为5的是汇总表
	GetAppList(ctx context.Context, req *appvo.AppListReqVo) (*appvo.AppListRespVo, error)
	// GetSummeryAppId 获取汇总表appId
	GetSummeryAppId(ctx context.Context, orgId int64) (int64, error)
}

type DatacenterRepo

type DatacenterRepo interface {
	UpdateBatchRowByRowIds(ctx context.Context, orgId, tableId int64, values map[int64]interface{}) error
	UpdateTableRowByRowId(ctx context.Context, orgId, tableId, rowId int64, values interface{}) error
	GetTableRowData(ctx context.Context, orgId, tableId int64, condition *datacentervo.LessCondsData, limit, offset int, columns []string, orders []datacentervo.Order) ([]map[string]interface{}, error)
	GetTableRowDataByRowId(ctx context.Context, orgId, tableId, rowId int64) (map[string]interface{}, error)
	GetTableRowListByRowIds(ctx context.Context, orgId, tableId int64, rowIds []int64) ([]map[string]interface{}, error)
	WrapperTableName(orgId, tableId int64) string
	JsonColumn(str string) string
	CreateTables(ctx context.Context, tables []*datacentervo.CreateTableReq) (*datacentervo.CreateTableResp, error)
	DatacenterExecutor(ctx context.Context, dsId, dbId int64, req *datacentervo.Executor) (*datacentervo.ExecutorResp, error)
	DatacenterExecutors(ctx context.Context, dsId, dbId int64, req []*datacentervo.Executor) (*datacentervo.ExecutorsResp, error)
}

type LockRepo

type LockRepo interface {
	// TryGetDistributedLock 锁住,防止并发
	TryGetDistributedLock(ctx context.Context, lockKey string, obtainDuration ...time.Duration) (func(), error)
}

type OrgColumnsRepo

type OrgColumnsRepo interface {
	GetColumns(ctx context.Context, orgId int64, columnIds []string) ([]*bo.OrgColumn, error)
	CreateColumns(ctx context.Context, orgId int64, columns []*po.OrgColumn) error
	DeleteColumn(ctx context.Context, orgId int64, columnId string) error
}

type OrgColumnsUseCase

type OrgColumnsUseCase struct {
	// contains filtered or unexported fields
}

func NewOrgColumnsUseCase

func NewOrgColumnsUseCase(repo OrgColumnsRepo, tableRepo TableRepo, logger log.Logger) *OrgColumnsUseCase

func (*OrgColumnsUseCase) CreateOrgColumn

func (*OrgColumnsUseCase) DeleteOrgColumn

func (*OrgColumnsUseCase) InitOrgColumns

func (*OrgColumnsUseCase) ReadOrgColumns

type PermissionRepo

type PermissionRepo interface {
	InitAppPermissionFieldAuthCreateTable(ctx context.Context, req *permissionvo.InitAppPermissionFieldAuthCreateTableReq) error
	InitAppPermissionFieldAuthDeleteTable(ctx context.Context, req *permissionvo.InitAppPermissionFieldAuthDeleteTableReq) error
}

type ProjectRepo

type ProjectRepo interface {
	ReportTableEvent(ctx context.Context, eventType msgPb.EventType, traceId string, event *projectvo.TableEvent) (*vo.CommonRespVo, error)
}

type RowRepo

type RowRepo interface {
	List(ctx context.Context, req *pb.ListRequest, query *form.QuerySqlReq, memberColumns []*pb.Column, relateColumnIds []string) (*po.Row, error)
	ListRaw(ctx context.Context, req *pb.ListRawRequest, memberColumns []*pb.Column) (*po.Row, error)
	Delete(ctx context.Context, condition *pb.Condition) (int64, error)

	CheckIsAppCollaborator(ctx context.Context, orgId, appId, userId int64) (bool, error)
	GetUserAppCollaboratorColumns(ctx context.Context, orgId, appId, userId int64) ([]*bo.CollaboratorColumn, error)
	GetAppCollaboratorColumns(ctx context.Context, orgId, appId int64) ([]*bo.CollaboratorColumn, error)
	GetDataCollaborators(ctx context.Context, orgId int64, dataIds []int64) ([]*pb.DataCollaborators, error)
	SwitchColumnCollaboratorOn(ctx context.Context, orgId, appId, tableId int64, columnId string) error
	SwitchColumnCollaboratorOff(ctx context.Context, orgId, appId, tableId int64, columnId string) error
	CopyColumnCollaborator(ctx context.Context, orgId, appId, tableId int64, fromColumnId, toColumnId string) error
}

type RowUseCase

type RowUseCase struct {
	// contains filtered or unexported fields
}

func NewRowUseCase

func NewRowUseCase(tableRepo TableRepo, rowRepo RowRepo, lockRepo LockRepo, datacenterRepo DatacenterRepo, appRepo AppRepo, logger log.Logger) *RowUseCase

func (*RowUseCase) CheckIsAppCollaborator

func (*RowUseCase) CopyColumnCollaborator

func (r *RowUseCase) CopyColumnCollaborator(ctx context.Context, orgId, appId, tableId int64, fromColumnId, toColumnId string) error

func (*RowUseCase) CopyRow

func (r *RowUseCase) CopyRow(ctx context.Context, req *pb.CopyRowRequest) (*pb.CopyRowReply, error)

func (*RowUseCase) CreateRows

func (r *RowUseCase) CreateRows(ctx context.Context, req *pb.CreateRowsRequest) (*pb.CreateRowsReply, error)

func (*RowUseCase) Delete

func (r *RowUseCase) Delete(ctx context.Context, req *pb.DeleteRequest) (*pb.DeleteReply, error)

func (*RowUseCase) DeleteRow

func (r *RowUseCase) DeleteRow(ctx context.Context, req *pb.DeleteRowRequest) (*pb.DeleteRowReply, error)

func (*RowUseCase) ExchangeSummaryCondition

func (*RowUseCase) GetAppCollaboratorRoles

func (*RowUseCase) GetDataCollaborators

func (*RowUseCase) List

func (r *RowUseCase) List(ctx context.Context, req *pb.ListRequest) (*pb.ListReply, error)

func (*RowUseCase) ListRaw

func (r *RowUseCase) ListRaw(ctx context.Context, req *pb.ListRawRequest) (*pb.ListRawReply, error)

func (*RowUseCase) MoveRow

func (r *RowUseCase) MoveRow(ctx context.Context, req *pb.MoveRowRequest) (*pb.MoveRowReply, error)

func (*RowUseCase) RecoverAttachment

func (*RowUseCase) RecycleAttachment

func (*RowUseCase) SwitchColumnCollaboratorOff

func (r *RowUseCase) SwitchColumnCollaboratorOff(ctx context.Context, orgId, appId, tableId int64, columnId string) error

func (*RowUseCase) SwitchColumnCollaboratorOn

func (r *RowUseCase) SwitchColumnCollaboratorOn(ctx context.Context, orgId, appId, tableId int64, columnId string) error

type TableRepo

type TableRepo interface {
	// StartTransactionLcGo 开启一个事务
	StartTransactionLcGo(ctx context.Context, fc func(tx *gorm.DB) error) error
	// CreateTable 创建一张表
	CreateTable(ctx context.Context, table *po.Table, columns []*po.TableColumn, tx *gorm.DB) error
	// GetTable 获取一张表
	GetTable(ctx context.Context, tableId int64) (*po.Table, error)
	// GetTables 获取一个app下的所有表
	GetTables(ctx context.Context, appId int64, tx ...*gorm.DB) ([]*po.Table, error)
	// GetTablesByApps 获取n个app下的所有表
	GetTablesByApps(ctx context.Context, appIds []int64) (map[int64][]*po.Table, error)
	// GetTablesByOrgId 获取一个组织下的所有表
	GetTablesByOrgId(ctx context.Context, orgId int64) ([]*po.Table, error)
	// UpdateTableName 更新表名字
	UpdateTableName(ctx context.Context, appId, tableId int64, name string, userId int64) error
	// DeleteTable 删除一张表
	DeleteTable(ctx context.Context, appId, tableId int64, tx *gorm.DB) error
	// CopyTables 拷贝表,如果没有传tableIds,则会拷贝整个appId下的表
	CopyTables(ctx context.Context, srcAppId, destAppId int64,
		tableIds []int64, oldToNewPermission map[int64]int64) (map[int64]int64, error)
	// SetAutoSchedule 设置自动排期开关
	SetAutoSchedule(ctx context.Context, appId, tableId int64, autoScheduleFlag int32, userId int64) error
	// GetSummeryTableId 获取汇总表的tableId
	GetSummeryTableId(ctx context.Context, orgId int64) (int64, error)
	// GetColumn 获取一列表头
	GetColumn(ctx context.Context, tableId int64, columnId string, isNeedDescription bool) (*bo.Column, error)
	// GetColumns 获取一个table下的所有表头
	GetColumns(ctx context.Context, tableId int64) ([]*bo.Column, error)
	// GetColumnsByTables 获取n个table下的表头
	GetColumnsByTables(ctx context.Context, tableIds []int64, columnIds []string, isNeedDescription bool) ([]*bo.Columns, error)
	// GetAppColumnIdsByType 获取某种类型的列名
	GetAppColumnIdsByType(ctx context.Context, appId int64, columnType string) ([]string, error)
	// GetColumnsMap 获取表头的map
	GetColumnsMap(ctx context.Context, tableId int64) (map[string]*bo.Column, error)
	// GetRefColumns 获取引用列
	GetRefColumns(ctx context.Context, columns []*tablePb.Column) (map[string]*bo.Column, error)
	// GetAppTableColumns 获取appId下的所有表
	GetAppTableColumns(ctx context.Context, appId int64, columnIds []string) ([]*bo.Columns, error)
	// CreateColumn 创建一列
	CreateColumn(ctx context.Context, poColumn *po.TableColumn, tx ...*gorm.DB) error
	// UpdateColumn 更新一列数据
	UpdateColumn(ctx context.Context, poColumn *po.TableColumn, tx ...*gorm.DB) error
	// UpdateColumnWithOldColumnId 更新column,而且更新列名
	UpdateColumnWithOldColumnId(ctx context.Context, tc *po.TableColumn, oldColumnId string, tx ...*gorm.DB) error
	// UpdateColumnAndResetOrgColumnId 更新列数据以及重置关联组织字段
	UpdateColumnAndResetOrgColumnId(ctx context.Context, tc *po.TableColumn, oldColumnId string, tx ...*gorm.DB) error
	// ChangeColumnId 更改列名
	ChangeColumnId(ctx context.Context, oldColumnId string, poColumn *po.TableColumn, tx ...*gorm.DB) error
	// UpdateColumnDescription 更新列的描述
	UpdateColumnDescription(ctx context.Context, tableId int64, columnId, description string) error
	// DeleteColumn 删除一列
	DeleteColumn(ctx context.Context, tableId int64, columnId string, tx *gorm.DB) error
	// CheckOrgColumnIdHadUseInOrg 查询一个组织字段是否在组织内使用
	CheckOrgColumnIdHadUseInOrg(ctx context.Context, orgId int64, columnId string) (bool, error)
	// CheckOrgColumnIdHadUseInTable 查询一个组织字段是否在一个表内使用
	CheckOrgColumnIdHadUseInTable(ctx context.Context, tableId int64, columnId string) (bool, error)
	// GetNewColumnId 生成一个新的列名
	GetNewColumnId(category int) string

	GetColumnCollaboratorRoleIds(column *tablePb.Column) []string
	CheckColumnCollaboratorSwitchOn(column *tablePb.Column) bool
	CheckIsCollaboratorColumn(columnType string) bool

	GetColumnRefTableInfo(column *pb.Column, columns []*pb.Column) (int64, string)
	GetColumnPropsStringValue(column *pb.Column, key string) string
}

TableRepo 表头相关

type TableUseCase

type TableUseCase struct {
	// contains filtered or unexported fields
}

func NewTableUseCase

func NewTableUseCase(repo TableRepo, lockRepo LockRepo, appRepo AppRepo, datacenterRepo DatacenterRepo,
	Rows *RowUseCase, orgRepo OrgColumnsRepo, permissionRepo PermissionRepo,
	goPushRepo pushPb.PushHTTPClient, projectRepo ProjectRepo, logger log.Logger) *TableUseCase

func (*TableUseCase) CopyColumn

CopyColumn 拷贝列

func (*TableUseCase) CopyTables

CopyTables 拷贝表以及列数据,目前用于应用模板

func (*TableUseCase) CreateColumn

func (*TableUseCase) CreateSummeryTable

CreateSummeryTable 创建汇总表

func (*TableUseCase) CreateTable

CreateTable 创建普通的表

func (*TableUseCase) DeleteColumn

func (*TableUseCase) DeleteTable

DeleteTable 删除一张表

func (*TableUseCase) GetOrgTables

func (*TableUseCase) ReadOrgTableSchemas

ReadOrgTableSchemas 读取组织内的所有表的某些的字段

func (*TableUseCase) ReadSummeryTableId

func (*TableUseCase) ReadTable

func (*TableUseCase) ReadTableSchemas

func (*TableUseCase) ReadTables

ReadTables 读取一个app下的所有表

func (*TableUseCase) ReadTablesByApps

func (*TableUseCase) RenameTable

RenameTable 重命名表

func (*TableUseCase) SetAutoSchedule

SetAutoSchedule 设置自动排期开关

func (*TableUseCase) UpdateColumn

type UserCenterRepo

type UserCenterRepo interface {
}

Directories

Path Synopsis
bo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL