An entity framework for Go
Full Changelog: https://github.com/ent/ent/compare/v0.12.0...v0.12.5
This release contains several bug fixes, many small features, and improvements to the ent/schema, ent runtime, and ent codegen. There are 3 major features that were added to the framework: Edge Schemas, GraphQL Schema Generator and a completely new infrastructure for generating schema migrations using Atlas. Please, visit these links to learn more about these new functionalities.
In the next version, we plan to start experimenting with generics to reduce the amount of generated code and may consider exposing new generics-based extensions. Additional tasks that are on our list are query interceptors, polymorphic edges, a toolset for executing migrations safely, and a list of small runtime improvements that exist in our issue tracker.
You are welcome to join our Discord Server, Slack channel and subscribe to the Ent newsletter to get updates on the new features, proposal discussions, and content we release.
Table()
predicate and warn about reserved schema name (Client
) by @masseelch in https://github.com/ent/ent/pull/2486
fmt.Errorf
instead of errors.Wrapf
by @frederikhors in https://github.com/ent/ent/pull/2608
WhereInput
in with .Where()
by @frederikhors in https://github.com/ent/ent/pull/2691
Full Changelog: https://github.com/ent/ent/compare/v0.10.1...v0.11
Version v0.10.1 includes 2 fixes for bugs that were introduced in version v0.10.0, and additional improvements for schema migration.
Full Changelog: https://github.com/ent/ent/compare/v0.10.0...v0.10.1
Dear community,
We're very happy to announce the release of the next version of Ent: v0.10. It has been almost six months since v0.9.1, so naturally, there's a ton of new stuff in this release. Please, read more about it in the Ent blog.
[]byte
by @hedwigz in https://github.com/ent/ent/pull/1863
NotEmpty()
to []byte
by @hedwigz in https://github.com/ent/ent/pull/1869
Save
to Exec
in create operation by @RiskyFeryansyahP in https://github.com/ent/ent/pull/1891
time with time zone
and time without time zone
by @s-takehana in https://github.com/ent/ent/pull/2257
Full Changelog: https://github.com/ent/ent/compare/v0.9.1...0.10.0
Version v0.9.1 includes 1 minor bug fix that was introduced in version v0.9.0, and additional bug fixes and improvements for the Upsert
and Lock
feature flags.
Bug fixes:
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.
entc.Extension
API.Exec
and ExecX
to Create/CreateBulk builders.sql.ValueScanner
interface:type DocID string
func (*DocID) Scan(value interface{}) (error) { ... }
func (DocID) Value() (driver.Value, error) { ... }
ValueScanner
types work with enum fields.field.Int("utime").
UpdateDefault(func() int { ... })
EXISTS
(and NOT EXISTS
) predicates.CREATE INDEX
builder.CHECK
annotation.Collation
annotation in schema fields.Prefix
and PrefixColumns
options for index annotations (see docs).@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 🙏
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.
go get -u entgo.io/[email protected]
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)
DISTINCT
clause in queries (#1371).ent.Order
functions, and will require them to modify the function signature from func (*sql.Selector, func() bool)
to func (*sql.Selector)
.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 not T
). If you want to get T
instead, define it in the GoType
option instead, even if the sql.Scanner
interface is implemented by the pointer (*T
).DEFAULT
clauses using entsql.Annotation
:
field.String("uuid").
Annotation(entsql.Annotation{
Default: "uuid_generate_v4()",
})
Thanks, @dilipkk-foyernet, @enjoylife, @rubensayshi, @bshihr, @rotemtam, @alexsn, @cliedeman, @chrisguox, @uta-mori, @Bladrak for contributing to the Ent project and participating in this release.
This release contains 1 major feature, small improvements and bug fixes to ent codegen and its runtime, and an experimental integration with protobuf.
%v
with %w
) when it's useful - Thanks @mgabeler-lee-6rsent.IsConstraintError
function catches now FK constraint violations (#1316) - Thanks @rotemtamedge.Annotation
provides a way to override the struct-tag for the Edges
field in generated models. #1315 changes the implementation to extend the struct-tag and override the default JSON tag only if it was provided by the annotation.DefaultFunc
in user-defined PKs (#1290).proto
files from ent/schema.ent init
now creates a `generate.go file that matches Go 1.16 (#1300) - Thanks @uta-moriThanks @kercylan98, @HarikiRito, @SogoCZE, @wenj91 for reporting issues and being involved in the project.
Package path was changed from github.com/facebook/ent
to entgo.io/ent
.
Please use the following command (on Mac) to replace imports:
For github.com/facebookincubator/ent-contrib
:
find . -type f -name '*.go' -exec sed -i '' 's/github.com\/facebookincubator\/ent-contrib/entgo.io\/contrib/g' {} +
For github.com/facebook/ent
:
find . -type f -name '*.go' -exec sed -i '' 's/github.com\/facebook/entgo.io/g' {} +
DefaultFunc
option for fields (#1153)Add support for alternate schema/database names (Thanks @marwan-at-work). Read more here
Add field.Comment
support in generated assets (Thanks @kerbelp)
Breaking change: add the edge-name as the default json tag for edge fields (#1204):
- Users []*User
+ Users []*User `json:"users,omitempty"`
Besides these, there are multiple bug fixes and small perf improvements in this release.
Users that upgrade to this version and already use schema-hooks or the privacy policy in ent/schema, should follow the steps mentioned in https://github.com/facebook/ent/issues/1115#issuecomment-753944990.
DefaultFunc
option to string and bytes buildersValueMap
option for enum builderbinary
columns in MySQL (Thanks @nolotz)