при необходимости писать чистые запросы
Что вы используете? Postgres
https://github.com/Masterminds/squirrel
Белку + pgx + scany
GORM
А вообще вот выдержка из awesome go SQL query builder, libraries for building and using SQL. buildsqlx - Go database query builder library for PostgreSQL. dbq - Zero boilerplate database operations for Go. Dotsql - Go library that helps you keep sql files in one place and use them with ease. gendry - Non-invasive SQL builder and powerful data binder. godbal - Database Abstraction Layer (dbal) for go. Support SQL builder and get result easily. goqu - Idiomatic SQL builder and query library. gosql - SQL Query builder with better null values support. hasql - Library for accessing multi-host SQL database installations. igor - Abstraction layer for PostgreSQL that supports advanced functionality and uses gorm-like syntax. jet - Framework for writing type-safe SQL queries in Go, with ability to easily convert database query result into desired arbitrary object structure. mpath - MPTT (Modified Preorder Tree Traversal) package for SQL records - materialized path realisation. ormlite - Lightweight package containing some ORM-like features and helpers for sqlite databases. ozzo-dbx - Powerful data retrieval methods as well as DB-agnostic query building capabilities. qry - Tool that generates constants from files with raw SQL queries. sq - Type-safe SQL builder and struct mapper for Go. sqlf - Fast SQL query builder. sqlingo - A lightweight DSL to build SQL in Go. sqrl - SQL query builder, fork of Squirrel with improved performance. Squalus - Thin layer over the Go SQL package that makes it easier to perform queries. Squirrel - Go library that helps you build SQL queries. xo - Generate idiomatic Go code for databases based on existing schema definitions or custom queries supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server.
Что за белка?
Squirrel
Squirrel
Squirrel долго писать, и я сократил до "белка"))
Возможно, но для проекта будет проще писать в одном стиле без использования доп инструментов, поэтому и спрашиваю тех кто работал с gormом. В остальных задачах вопросов к gorm нет. Код более локоничный
Вот это https://gorm.io/docs/associations.html#Replace-Associations смотрели?
Обсуждают сегодня