This release contains several bug fixes, performance and runtime improvements, and multiple new features in ent/schema and ent-codegen.
The next release (~1 month from now) is going to be focused on adding support for ent schema-versioning, and the initial support for the new SQL schema migration. Proposal issues/discussions are going to be posted next week.
Users are welcome to join our Slack channel and subscribe to the Ent newsletter to get ~monthly updates on the new features, proposal discussions, and content we release.
How to update
go get -u entgo.io/ent@v0.8.0
Summary
entc/gen
- Allow extending and injecting dependencies to the generated clients/builders. See example in Ent website.
- Add
Select
option to<T>UpdateOne
builders. See example in Ent website:pedro, err := client.Pet. UpdateOneID(id). SetAge(9). Select(pet.FieldName, pet.FieldAge). Save(ctx)
- (perf) Filter duplicate identifiers when loading O2M/M2O and M2M edges.
- Allow disabling the
DISTINCT
clause in queries (#1371). - Change custom ordering/grouping functions format - This change can affect users that use custom
ent.Order
functions, and will require them to modify the function signature fromfunc (*sql.Selector, func() bool)
tofunc (*sql.Selector)
. - Code generation API - Add global annotation option - See documentation.
ent/schema
- Major change: The codegen now uses the actual
GoType
defined in the schema in the generated builders/structs (see #1428).
TL;DR - Using*T
now means that you'll get*T
as a field type (and notT
). If you want to getT
instead, define it in theGoType
option instead, even if thesql.Scanner
interface is implemented by the pointer (*T
). - Add database cascading deletion support to edge annotations. See FK annotation.
- Add support for custom
DEFAULT
clauses usingentsql.Annotation
:field.String("uuid"). Annotation(entsql.Annotation{ Default: "uuid_generate_v4()", })
- Add annotation for configuring FK symbols (#1423).
dialect/sql
- Add basic predicates for comparing 2 columns.
- Add on-conflict handling to sql builder (initial support for upsert).
dialect/sql/schema
- JSON column migration for MariaDB10.3.13 - Thanks @AnnatarHe for reporting this issue.
- Initial support for Postgres arrays in migration.
contrib
- Support additional types in entproto.
- Support ordering by ID fields in entgql.
Thanks, @dilipkk-foyernet, @enjoylife, @rubensayshi, @bshihr, @rotemtam, @alexsn, @cliedeman, @chrisguox, @uta-mori, @Bladrak for contributing to the Ent project and participating in this release.