SQL #

MySQL
A complete guide to connecting MySQL in Go — the database/sql package as an abstraction, the go-sql-driver/mysql driver, proper connection pooling, querying and scanning results, prepared statements, transactions with deferred rollback, null values, batch inserts, context-aware queries, and a complete repository pattern.
MSSQL
A complete guide to connecting Microsoft SQL Server in Go — the microsoft/go-mssqldb driver, connection strings with various authentication methods, queries with named parameters, stored procedures, the OUTPUT clause for INSERT, transactions, and the repository pattern for SQL Server.
Oracle
A complete guide to connecting Oracle Database in Go — the godror driver with Oracle Client, connection strings, :1 placeholders and named binding, RETURNING INTO for INSERT, sequences, ROWNUM and FETCH for pagination, stored procedures and REF CURSORs, and the repository pattern for Oracle.
PostgreSQL
A complete guide to connecting PostgreSQL in Go — the pgx and lib/pq drivers, connection strings, $1 placeholders, RETURNING for INSERT, arrays and JSONB, COPY for fast bulk inserts, listen/notify for real-time events, transactions with isolation levels, and a complete repository pattern.
GORM
A complete guide to GORM in Go — the most popular ORM for Go, connecting to various databases, gorm struct tags, auto migration, idiomatic CRUD, HasOne/HasMany/BelongsTo/ManyToMany associations, preloading, lifecycle hooks, transactions, scopes, soft deletes, and building an e-commerce service with model relationships.
About | Author | Content Scope | Editorial Policy | Privacy Policy | Disclaimer | Contact