Hallucinate hella cursor rules
This commit is contained in:
23
.cursor/rules/database-abstraction.mdc
Normal file
23
.cursor/rules/database-abstraction.mdc
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
globs: *.go
|
||||
description: Database abstraction layer conventions
|
||||
---
|
||||
|
||||
# Database Abstraction Standards
|
||||
|
||||
## High-Level Interface
|
||||
The [db.go](mdc:db.go) file provides a high-level database interface. Always use these methods instead of raw GORM calls:
|
||||
|
||||
- `GetTokenForCharacter(characterName string) (*Token, error)`
|
||||
- `SaveTokenForCharacter(token *Token) error`
|
||||
- `AutoMigrate(dst ...interface{}) error`
|
||||
|
||||
## Never Use Raw GORM
|
||||
- Don't call `s.db.DB().Where(...)` directly
|
||||
- Don't call `s.db.DB().Save(...)` directly
|
||||
- Always use the abstracted methods in the DB interface
|
||||
|
||||
## Database Operations
|
||||
- All database operations should be logged with appropriate context
|
||||
- Include character names in log messages for database operations
|
||||
- Handle errors gracefully and log them with context
|
||||
Reference in New Issue
Block a user