30 lines
1.1 KiB
Go
30 lines
1.1 KiB
Go
package activities
|
||
|
||
import (
|
||
"beacon/pkg/pb"
|
||
"context"
|
||
"fmt"
|
||
"math/rand"
|
||
)
|
||
|
||
// AddSuffixActivity appends a fixed suffix to the input data.
|
||
func AddSuffixActivity(ctx context.Context, data string) (string, error) {
|
||
suffixes := []string{
|
||
"-one", "-two", "-three", "-four", "-five",
|
||
"-six", "-seven", "-eight", "-nine", "-ten",
|
||
}
|
||
suffix := suffixes[rand.Intn(len(suffixes))]
|
||
result := fmt.Sprintf("%s%s", data, suffix)
|
||
fmt.Println("Go Activity: Modified data to:", result)
|
||
return result, nil
|
||
}
|
||
|
||
// LoadCompositeCaseSteps 辅助 Activity 用于加载复合案例步骤定义 (可选,如果 Workflow 输入不包含完整定义)
|
||
func LoadCompositeCaseSteps(ctx context.Context, compositeCaseId string) ([]*pb.CompositeCaseStepDefinition, error) {
|
||
// 这是一个 Activity,它可以在 Python Worker 或一个 Go Activity Worker 中实现
|
||
// 这个 Activity 负责从数据库加载 composite_case_steps 表中的数据
|
||
// 并将其转换为 Protobuf 列表返回
|
||
// 请确保你在 Python Worker 或另一个 Go Worker 中注册并实现了这个 Activity
|
||
return nil, fmt.Errorf("activity not implemented yet") // 仅作示例
|
||
}
|