()
| 17 | ) |
| 18 | |
| 19 | func main() { |
| 20 | ctx := context.Background() |
| 21 | |
| 22 | // 1. 创建存储后端 |
| 23 | backend := backends.NewStateBackend() |
| 24 | |
| 25 | // 2. 示例 1: Thread Scope(会话级) |
| 26 | fmt.Println("=== 示例 1: Thread Scope Working Memory ===") |
| 27 | demonstrateThreadScope(ctx, backend) |
| 28 | |
| 29 | fmt.Println("\n=== 示例 2: Resource Scope Working Memory ===") |
| 30 | demonstrateResourceScope(ctx, backend) |
| 31 | |
| 32 | fmt.Println("\n=== 示例 3: 带 Schema 的 Working Memory ===") |
| 33 | demonstrateWithSchema(ctx, backend) |
| 34 | |
| 35 | fmt.Println("\n=== 示例 4: Find and Replace(实验性)===") |
| 36 | demonstrateFindAndReplace(ctx, backend) |
| 37 | } |
| 38 | |
| 39 | func demonstrateThreadScope(ctx context.Context, backend backends.BackendProtocol) { |
| 40 | // 创建 thread scope 的 Working Memory 管理器 |
nothing calls this directly
no test coverage detected