MCPcopy Create free account
hub / github.com/astercloud/aster / main

Function main

examples/session-mysql/main.go:18–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16)
17
18func main() {
19 ctx := context.Background()
20
21 // ====== 示例 1: 连接 MySQL ======
22 fmt.Println("=== Example 1: Connect to MySQL 8.0+ ===")
23 service := setupMySQLService()
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: JSON 列的优势 ======
35 fmt.Println("\n=== Example 4: JSON Column Benefits ===")
36 jsonColumnExample(ctx, service, sess.ID)
37
38 // ====== 示例 5: 查询优化 ======
39 fmt.Println("\n=== Example 5: Query Optimization ===")
40 queryOptimizationExample(ctx, service, sess.UserID)
41
42 fmt.Println("\n✅ All MySQL examples completed!")
43}
44
45// setupMySQLService 设置 MySQL 服务
46func setupMySQLService() *mysql.Service {

Callers

nothing calls this directly

Calls 6

setupMySQLServiceFunction · 0.85
jsonColumnExampleFunction · 0.85
queryOptimizationExampleFunction · 0.85
createSessionExampleFunction · 0.70
appendEventsExampleFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected