()
| 16 | ) |
| 17 | |
| 18 | func main() { |
| 19 | ctx := context.Background() |
| 20 | |
| 21 | // ====== 示例 1: 基础连接和配置 ====== |
| 22 | fmt.Println("=== Example 1: Basic Connection ===") |
| 23 | service := setupPostgreSQLService() |
| 24 | defer func() { _ = service.Close() }() |
| 25 | |
| 26 | // ====== 示例 2: 创建 Session ====== |
| 27 | fmt.Println("\n=== Example 2: Create Session ===") |
| 28 | sess := createSessionExample(ctx, service) |
| 29 | |
| 30 | // ====== 示例 3: 追加事件 ====== |
| 31 | fmt.Println("\n=== Example 3: Append Events ===") |
| 32 | appendEventsExample(ctx, service, sess.ID) |
| 33 | |
| 34 | // ====== 示例 4: 状态管理 ====== |
| 35 | fmt.Println("\n=== Example 4: State Management ===") |
| 36 | stateManagementExample(ctx, service, sess.ID) |
| 37 | |
| 38 | // ====== 示例 5: 工件版本管理 ====== |
| 39 | fmt.Println("\n=== Example 5: Artifact Versioning ===") |
| 40 | artifactVersioningExample(ctx, service, sess.ID) |
| 41 | |
| 42 | // ====== 示例 6: 查询和过滤 ====== |
| 43 | fmt.Println("\n=== Example 6: Query and Filter ===") |
| 44 | queryExample(ctx, service, sess.UserID) |
| 45 | |
| 46 | fmt.Println("\n✅ All examples completed successfully!") |
| 47 | } |
| 48 | |
| 49 | // setupPostgreSQLService 设置 PostgreSQL 服务 |
| 50 | func setupPostgreSQLService() *postgres.Service { |
nothing calls this directly
no test coverage detected