github ent/ent v0.9.0

latest releases: v0.13.1, v0.13.0, v0.12.5...
2 years ago

We are excited to share the v0.9.0 release! 🎊

This release contains several bug fixes and many small features and improvements to the ent/schema, ent runtime, and ent-codegen. Also, 2 major features were added to the framework, Upsert/UpsertBulk APIs, and Row-level locking (see details below). See examples:

// Upsert one.
id, err := client.User.
    Create().
    SetAge(30).
    SetName("Ariel").
    OnConflict().
    SetName("Mashraki").
    ID(ctx)

// Upsert bulk.
err := client.User. 
    CreateBulk(builders...). 
    OnConflict(). 
    UpdateNewValues().
    Exec(ctx)

// Row-level locking.
tx.User.Query().
    Where(user.Name(name)).
    ForUpdate().
    Only(ctx)

In the next release, we'll introduce the new migration framework for SQL.

You are welcome to join our Slack channel and subscribe to the Ent newsletter to get updates on the new features, proposal discussions, and content we release.

Summary

ent/gen

schema/field

  • Allow simple types (and UUID types) to implement the sql.ValueScanner interface:
type DocID string
func (*DocID) Scan(value interface{}) (error) { ... }
func (DocID) Value() (driver.Value, error) { ... }
  • Make non-string ValueScanner types work with enum fields.
  • Support unique bytes.
  • Add support for setting update default functions to numeric fields:
field.Int("utime").
	UpdateDefault(func() int { ... })

schema/index

  • Add support for attaching custom annotations for indexes.

dialect/sql

  • Add union and with-recursive API for builder (see example #1599).
  • Add EXISTS (and NOT EXISTS) predicates.
  • Support for USING method in CREATE INDEX builder.
  • Add support for custom SQL query modifiers (see website).

dialct/sql/schema

  • Support for PostgreSQL and MySQL numeric and decimal types in migration.

dialect/entsql

  • Add support for CHECK annotation.
  • Support for Collation annotation in schema fields.
  • Add Prefix and PrefixColumns options for index annotations (see docs).

dialect/sql/sqlscan

  • Supporting scanning to embedded types and optional fields.

@vojta001, @chris-rock, @giautm, @rotemtam, @zeevmoney, @yonidavidson, @wenerme, @cliedeman, @DuGlaser, @davebehr1, @sywesk, @adayNU, @y-yagi, @wzyjerry, @mgabeler-lee-6rs, @tarrencev, @ivanvanderbyl, @bshihr, @MONAKA0721, @rubensayshi, @zzwx, @nmemoto, @neel229, @squarebat, @timoha, @shomodj, @masseelch, @sadmansakib, @arielitovsky, @akfaew, @amrnt, @Sacro, @alexsn - Thanks for your contribution, Ariel 🙏

Don't miss a new ent release

NewReleases is sending notifications on new releases.