Warning: mkdir(): No space left on device in /var/www/tg-me/post.php on line 37

Warning: file_put_contents(aCache/aDaily/post/golang_books/--): Failed to open stream: No such file or directory in /var/www/tg-me/post.php on line 50
Golang Books | Telegram Webview: golang_books/986 -
Telegram Group & Telegram Channel
📢 GORM теперь поддерживает дженерики — работа с БД в Go стала ещё проще и безопаснее!

С версии GORM v1.30.0 появилась полноценная поддержка дженериков (Go 1.18+), которая позволяет писать более выразительный и типобезопасный код без шаблонных повторов.

🔧 Пример:


ctx := context.Background()

// Создание
gorm.G[User](db).Create(ctx, &User{Name: "Alice"})

// Поиск
user, err := gorm.G[User](db).Where("name = ?", "Alice").First(ctx)

// Обновление
gorm.G[User](db).Where("id = ?", user.ID).Update(ctx, "age", 30)

// Удаление
gorm.G[User](db).Where("id = ?", user.ID).Delete(ctx)


Что это даёт:
• Типобезопасность на этапе компиляции
• Более компактный и читаемый код
• Лёгкая интеграция с OnConflict, Joins, Hints, Preload и пр.
• Улучшенный DX (developer experience)

📎 Документация: https://gorm.io/docs/the_generics_way.html

Если ты пишешь на Go и используешь GORM — самое время перейти на новый стиль.



tg-me.com/golang_books/986
Create:
Last Update:

📢 GORM теперь поддерживает дженерики — работа с БД в Go стала ещё проще и безопаснее!

С версии GORM v1.30.0 появилась полноценная поддержка дженериков (Go 1.18+), которая позволяет писать более выразительный и типобезопасный код без шаблонных повторов.

🔧 Пример:


ctx := context.Background()

// Создание
gorm.G[User](db).Create(ctx, &User{Name: "Alice"})

// Поиск
user, err := gorm.G[User](db).Where("name = ?", "Alice").First(ctx)

// Обновление
gorm.G[User](db).Where("id = ?", user.ID).Update(ctx, "age", 30)

// Удаление
gorm.G[User](db).Where("id = ?", user.ID).Delete(ctx)


Что это даёт:
• Типобезопасность на этапе компиляции
• Более компактный и читаемый код
• Лёгкая интеграция с OnConflict, Joins, Hints, Preload и пр.
• Улучшенный DX (developer experience)

📎 Документация: https://gorm.io/docs/the_generics_way.html

Если ты пишешь на Go и используешь GORM — самое время перейти на новый стиль.

BY Golang Books




Share with your friend now:
tg-me.com/golang_books/986

View MORE
Open in Telegram


Golang Books Telegram | DID YOU KNOW?

Date: |

Telegram Gives Up On Crypto Blockchain Project

Durov said on his Telegram channel today that the two and a half year blockchain and crypto project has been put to sleep. Ironically, after leaving Russia because the government wanted his encryption keys to his social media firm, Durov’s cryptocurrency idea lost steam because of a U.S. court. “The technology we created allowed for an open, free, decentralized exchange of value and ideas. TON had the potential to revolutionize how people store and transfer funds and information,” he wrote on his channel. “Unfortunately, a U.S. court stopped TON from happening.”

Telegram today rolling out an update which brings with it several new features.The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations.

Golang Books from sa


Telegram Golang Books
FROM USA