Files
main/rules-v0/go-backend-scalability-cursorrules-prompt-file/database-interaction-best-practices.mdc
2025-02-27 00:04:07 +05:30

10 lines
402 B
Plaintext

---
description: Best practices when interacting with databases in backend Go code.
globs: */db/**/*.go
---
When interacting with databases:
- Use prepared statements to prevent SQL injection.
- Handle database errors gracefully.
- Consider using an ORM for complex queries and data modeling.
- Close database connections when they are no longer needed.
- Use connection pooling to improve performance.