|
1 | 1 | // Package gosqlx provides a high-performance SQL parsing SDK for Go with zero-copy tokenization |
2 | 2 | // and object pooling. It offers production-ready SQL lexing, parsing, and AST generation with |
3 | | -// support for multiple SQL dialects. |
| 3 | +// support for multiple SQL dialects and advanced SQL features. |
4 | 4 | // |
5 | | -// Features: |
| 5 | +// Core Features: |
6 | 6 | // |
7 | 7 | // - Zero-copy tokenization for optimal performance |
8 | 8 | // - Object pooling for 60-80% memory reduction |
|
12 | 12 | // - Performance monitoring and metrics collection |
13 | 13 | // - Visitor pattern support for AST traversal |
14 | 14 | // |
| 15 | +// Advanced SQL Features (Phase 2 - v1.2.0+): |
| 16 | +// |
| 17 | +// - Common Table Expressions (CTEs) with WITH clause |
| 18 | +// - Recursive CTEs with WITH RECURSIVE support |
| 19 | +// - Multiple CTEs in single query |
| 20 | +// - Set operations: UNION, UNION ALL, EXCEPT, INTERSECT |
| 21 | +// - Complex query compositions and left-associative parsing |
| 22 | +// - ~70% SQL-92 standards compliance |
| 23 | +// |
15 | 24 | // Basic Usage: |
16 | 25 | // |
17 | 26 | // import ( |
|
38 | 47 | // } |
39 | 48 | // defer ast.ReleaseAST(astObj) |
40 | 49 | // |
| 50 | +// Advanced Usage (Phase 2 Features): |
| 51 | +// |
| 52 | +// // Common Table Expression (CTE) |
| 53 | +// cteSQL := `WITH sales_summary AS ( |
| 54 | +// SELECT region, SUM(amount) as total |
| 55 | +// FROM sales |
| 56 | +// GROUP BY region |
| 57 | +// ) SELECT region FROM sales_summary WHERE total > 1000` |
| 58 | +// |
| 59 | +// // Recursive CTE |
| 60 | +// recursiveSQL := `WITH RECURSIVE employee_tree AS ( |
| 61 | +// SELECT employee_id, manager_id, name FROM employees WHERE manager_id IS NULL |
| 62 | +// UNION ALL |
| 63 | +// SELECT e.employee_id, e.manager_id, e.name |
| 64 | +// FROM employees e JOIN employee_tree et ON e.manager_id = et.employee_id |
| 65 | +// ) SELECT * FROM employee_tree` |
| 66 | +// |
| 67 | +// // Set Operations |
| 68 | +// unionSQL := `SELECT name FROM customers UNION SELECT name FROM suppliers` |
| 69 | +// exceptSQL := `SELECT product FROM inventory EXCEPT SELECT product FROM discontinued` |
| 70 | +// intersectSQL := `SELECT customer_id FROM orders INTERSECT SELECT customer_id FROM payments` |
| 71 | +// |
41 | 72 | // Performance: |
42 | 73 | // |
43 | 74 | // GoSQLX achieves: |
44 | | -// - 2.2M operations/second throughput |
45 | | -// - 8M tokens/second processing speed |
46 | | -// - <200ns latency for simple queries |
47 | | -// - Linear scaling to 128 cores |
48 | | -// - 60-80% memory reduction with pooling |
| 75 | +// - 946K+ sustained operations/second (30s load testing) |
| 76 | +// - 1.25M+ operations/second peak throughput (concurrent) |
| 77 | +// - 8M+ tokens/second processing speed |
| 78 | +// - <280ns latency for simple queries |
| 79 | +// - <1μs latency for complex queries with CTEs/set operations |
| 80 | +// - Linear scaling to 128+ cores |
| 81 | +// - 60-80% memory reduction with object pooling |
| 82 | +// - Zero memory leaks under extended load |
| 83 | +// - Race-free concurrent operation validated |
49 | 84 | // |
50 | 85 | // For more examples and detailed documentation, see: |
51 | 86 | // https://github.com/ajitpratap0/GoSQLX |
|
0 commit comments