Skip to content

Commit 14e3ae5

Browse files
committed
chore: update README
1 parent a6dce67 commit 14e3ae5

File tree

1 file changed

+8
-68
lines changed

1 file changed

+8
-68
lines changed

README.md

Lines changed: 8 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,27 @@
1515
- **CRUD Operations**: Complete Create, Read, Update, Delete operation support
1616
- **Memory Efficient**: Connection pool-based resource management for optimal performance
1717

18-
## Quick Start
18+
## Dependencies
19+
20+
- [`github.com/go-sql-driver/mysql`](https://github.com/go-sql-driver/mysql)
21+
- [`github.com/pardnchiu/go-logger`](https://github.com/pardnchiu/go-logger)
22+
23+
24+
## How to use
1925

2026
### Installation
2127
```bash
2228
go get github.com/pardnchiu/golang-mysql-pool
2329
```
2430

25-
### Basic Usage
31+
### Initialization
2632
```go
2733
package main
2834

2935
import (
3036
"fmt"
3137
"log"
3238

33-
_ "github.com/go-sql-driver/mysql"
3439
mysqlPool "github.com/pardnchiu/golang-mysql-pool"
3540
)
3641

@@ -344,71 +349,6 @@ result, err := pool.Write.Exec("UPDATE users SET last_login = NOW() WHERE id = ?
344349
- Automatic release of unused connections
345350
- Streaming result set processing support
346351

347-
## Architecture Overview
348-
349-
```mermaid
350-
graph TB
351-
subgraph "Application Layer"
352-
APP[Application]
353-
QC[Query Builder]
354-
end
355-
356-
subgraph "Connection Pool Layer"
357-
RP[Read Pool]
358-
WP[Write Pool]
359-
LM[Log Manager]
360-
end
361-
362-
subgraph "Database Layer"
363-
MR[MySQL Read Instance]
364-
MW[MySQL Write Instance]
365-
end
366-
367-
APP --> QC
368-
QC --> RP
369-
QC --> WP
370-
QC --> LM
371-
372-
RP --> MR
373-
WP --> MW
374-
375-
RP -.-> LM
376-
WP -.-> LM
377-
```
378-
379-
## Flow Chart
380-
381-
```mermaid
382-
flowchart TD
383-
A[Initialize Config] --> B[Create Read Pool]
384-
B --> C[Create Write Pool]
385-
C --> D[Setup Logging]
386-
D --> E[Validate Connections]
387-
388-
E --> F{Operation Type}
389-
F -->|Query| G[Use Read Pool]
390-
F -->|Write| H[Use Write Pool]
391-
392-
G --> I[Get Connection]
393-
H --> I
394-
395-
I --> J{Connection Available?}
396-
J -->|No| K[Wait for Connection]
397-
J -->|Yes| L[Execute SQL]
398-
399-
K --> I
400-
401-
L --> M[Log Slow Query]
402-
M --> N[Release Connection]
403-
N --> O[Return Result]
404-
405-
O --> P{Close Pool?}
406-
P -->|No| F
407-
P -->|Yes| Q[Close All Connections]
408-
Q --> R[Clean Resources]
409-
R --> S[Pool Closed]
410-
```
411-
412352
## License
413353

414354
This source code project is licensed under the [MIT](https://github.com/pardnchiu/go-mysql-pool/blob/main/LICENSE) License.

0 commit comments

Comments
 (0)