In this challenge, you will implement a product inventory system using Go and SQL. You'll create functions that interact with a SQLite database to perform CRUD operations (Create, Read, Update, Delete) on products.
- Create a SQLite database with a
productstable - Implement the following functions:
CreateProduct- adds a new product to the databaseGetProduct- retrieves a product by IDUpdateProduct- updates a product's detailsDeleteProduct- removes a productListProducts- lists all products with optional filtering
- Ensure proper error handling for database operations
- Implement transaction support for operations that modify multiple records
- Use parameter binding to prevent SQL injection
- The included test file has scenarios checking all CRUD operations and error handling