How to use GORM to interact with your SQL databases in Golang

Опубликовано: 15 Октябрь 2024
на канале: Donald Feury (dak425)
45,873
590

🎨 Artist/Thumbnail Creator: https://jawhaj.art
📝 Blog: https://donaldfeury.xyz/topics
👥Memberships: https://vod.strms.net/j/UCTHij3Ac5Giz...

🖥 Example Code - https://gitlab.com/dak425/golang-gorm...

Want to create and interact with a SQL database schema but don't feel like writing SQL? Time to whip out GORM. GORM is a Code-First ORM that allows you to define your database tables, columns, and indexes using Go code. In addition, you can interact with said schema using the methods provided by the package, instead of writing raw SQL. (you still can if you need to)

THANK YOU ###
Newest Channel Member -
Newest Subscriber - Phillip Lineburg

WANT TO SUPPORT THE CHANNEL? ###
💰 Support Links: https://donaldfeury.xyz/donate

WANT TO ASK ME A QUESTION? ###
💬 Contact Me: https://donaldfeury.xyz/contact

SOCIAL PLATFORMS ###
🗣 Matrix: https://donaldfeury.xyz/matrix
💬 Pleroma: https://donaldfeury.xyz/pleroma
🗨️ Discord: https://donaldfeury.xyz/discord
🐦 Twitter: https://donaldfeury.xyz/twitter

VIDEO PLATFORMS ###
🎦 Twitch: https://donaldfeury.xyz/twitch
🎥 Odysee: https://donaldfeury.xyz/odysee

OTHER THINGS ###
📁 GitLab: https://donaldfeury.xyz/gitlab
🎥 My Gear: https://kit.co/dfeury

SOFTWARE I USE ###
🌐 Brave Browser - https://brave.com/
🎞 ffmpeg: https://ffmpeg.org/
📽️ Open Broadcaster Software: https://obsproject.com/
🎨 GIMP: https://www.gimp.org/
📙 Neovim: https://neovim.io/

Thank ya'll for your time and support!

Timestamps:
00:00 - Overview
01:16 - Using structs to define tables
05:31 - Migrations
07:24 - Seeding the database
08:08 - Find first result
10:01 - Connect to database
11:05 - Verbose logging
11:59 - Get all users
12:28 - Get all messages made by user
13:59 - Review generated queries
21:16 - Error handling
22:32 - Review

#golang #gorm #orm