Middle+
What databases have you worked with?
sobes.tech AI
Answer from AI
In working with Golang, I used different databases:
- Relational DBMS: PostgreSQL, MySQL. Used them for storing structured data with ORM (e.g., GORM) and raw SQL queries.
- NoSQL: MongoDB for document storage and flexible schema.
- In-memory databases: Redis for caching and fast data operations.
Example of connecting to PostgreSQL using the standard library database/sql:
import (
"database/sql"
_ "github.com/lib/pq"
)
func connect() (*sql.DB, error) {
connStr := "user=postgres dbname=mydb sslmode=disable"
return sql.Open("postgres", connStr)
}