Releases: ent/ent
v0.14.0
What's Changed
- ent: support schema views by @a8m in #4157
- dialect/entsql: add Skip annotation by @a8m in #4156
- examples/migration: add column with default value by @a8m in #3960
- Update data-migrations.mdx by @max-yue in #3973
- example/ent: add example for adding enums not at the end by @a8m in #3980
- chore: fix function names by @sunxunle in #3979
- doc/md: fix some broken links caused by trailing slash by @luantranminh in #3990
- ent: export all generated query operations by @a8m in #4001
- entc/gen: use query ops in generated code by @a8m in #4005
- build(deps): bump golangci/golangci-lint-action from 3 to 5 by @dependabot in #4033
- Update predicates.md by @max-yue in #3970
- doc/website: add skiptx option to graphql by @a8m in #4042
- dialect/sql/sqlgraph: replace IN with EXISTS in HasNeighbors/With predicates by @a8m in #4060
- entc/gen: add SetID to predefined mutation methods by @a8m in #4061
- entc/gen: fix conflict between set_id edge field and mutation fields by @a8m in #4062
- schema/field: add support for ValueScanner on field.Bytes() by @masseelch in #4067
- entc/gen/template: improve goimports time by adding missing imports by @a8m in #4103
- entc/gen: concurrent gofmt by @a8m in #4104
- schema/field: support annotating fields as deprecated by @a8m in #4132
- doc: explain how to use domain types properly by @a8m in #4134
- doc/website: fix ui build by @a8m in #4135
- doc: explain how to use composite types properly by @a8m in #4136
- doc: explain how to use enum types properly by @a8m in #4137
- doc: explain how to use triggers in migrations by @a8m in #4138
- doc: explain how to use extensions in migrations by @a8m in #4140
- doc: explain how to use policies in migrations by @a8m in #4141
- doc: minor fixes to rls page by @a8m in #4142
- doc/md: update enum doc by @hilakashai in #4145
- doc: update project description by @a8m in #4146
- update go doc to match the method name by @cpanato in #4083
- doc: explain how to use functional indexes in migrations by @a8m in #4149
- doc: explain how to use functional indexes in migrations by @a8m in #4150
- Getting Started MDX Improvements by @marakomer in #4151
New Contributors
- @max-yue made their first contribution in #3973
- @sunxunle made their first contribution in #3979
- @luantranminh made their first contribution in #3990
- @cpanato made their first contribution in #4083
- @marakomer made their first contribution in #4151
Full Changelog: v0.13.1...v0.14.0
v0.12.5
What's Changed
- doc: fix typos in paging.md by @a8m in #3458
- entsql: added OnDelete annotation by @giautm in #3459
- doc/md: update doc for OnDelete annotation by @giautm in #3460
- entc/gen: avoid ambiguous column names when joining the same table by @a8m in #3461
- entc/gen: rename .Order to .OrderOption by @a8m in #3468
- dialect/sql: skip formatting qualified columns by @a8m in #3469
- dialect/sql/sqlgraph: allow query edge fields with alias by @a8m in #3470
- dialect/sql: add method for finding selection occurrences in queries by @a8m in #3473
- doc: add entgql edge ordering by @a8m in #3482
- cmd/ent: hide the --idtype flag from generate command by @a8m in #3490
- dialect/sql/sqlgraph: replace id IN with EXISTS for HasNeighbors predicates by @a8m in #3492
- .github/workflow: added atlas-ci for examples by @giautm in #3496
- entc/gen: load referenced foreign-keys on eager-loading by @a8m in #3497
- entc/gen: remove unnecessary type arguments by @a8m in #3503
- doc/md/ci: fix broken link for ent/contrib/ci action's repo by @Arthur1 in #3504
- doc/md: edge ordering is supported by @masseelch in #3506
- entc/gen/template: fix intercept package imports by @masseelch in #3507
- doc: add schema inspection to getting-started page by @a8m in #3510
- entc/load: report 'go mod' errors on schema loading by @a8m in #3511
- .github/workflow: sync action by @giautm in #3513
- dialect/sql/schema: allow ariga.io/atlas schema diff to be extended by @a8m in #3514
- dialect/sql/schema: support passing schema diff options by @a8m in #3516
- dialect/sql: add OrderByRand option by @a8m in #3518
- ent/privacy: move some of the generated privacy helpers to ent/privacy by @a8m in #3527
- entc/gen: avoid conflict between order by edge-count and fields end with _count by @a8m in #3534
- Fix typo in docs by @jibbolo in #3539
- dialect/sql: expose the underlying builder of UpdateSet by @a8m in #3541
- Fix go install instruction for atlas by @toshi0607 in #3526
- entc/gen: fix conflicts between fields named 'op' and Mutation.Op by @a8m in #3550
- ent: document ent.Value returned by mutations by @a8m in #3556
- entc/gen: avoid conflict between package and receiver names by @a8m in #3563
- dialect/sql/sqljson: inline boolean values by @a8m in #3570
- schema/fields: validate for slices builder by @masseelch in #3566
- entc/gen: quote index annotations in generated schemas by @a8m in #3578
- entc/gen: allow naming ent/schemas as builder by @a8m in #3593
- entc/integration: add missing license header by @a8m in #3594
- dialect/sql/sqlgraph: expose standard modifier to eager-load N neighbors by @a8m in #3603
- .github: bump go version by @a8m in #3609
- go: update ariga.io/atlas to latest version by @a8m in #3610
- dialect/sql: support capturing predicates in selectors by @a8m in #3612
- dialect/sql: add predicate to check hasprefix between columns/fields by @a8m in #3614
- doc/md: fix edge.Annotations method name typo by @Mozuha in #3618
- doc: fix new project instructions in tutorial-setup.md by @vijal-patel in #3622
- entc/gen: allow catching nested tx attempt with errors.Is by @a8m in #3636
- Remove useless wording by @willfaught in #3640
- mark field as cleared when clearing edges by @yasser-sobhy in #3651
- dialect/sql/schema: allow only table creation modification in automatic schema planning by @a8m in #3660
- doc/website/blog: vis with atlas by @rotemtam in #3688
- entc/gen: add support for MapBulkCreate by @a8m in #3696
- Feat: added nil checks to sqlgraph constraint errors by @lucvankessel in #3701
- Update 2022-05-09-versioned-migrations-sum-file.md by @gedalyah-ariga in #3685
- doc/ci - removed a reference to a hard coded go version by @dorav in #3732
- go: update ariga.io/atlas to latest version by @a8m in #3751
- doc/website: visualize ent/schema as erd by @a8m in #3758
- doc/md: fix custom predicate example by @masseelch in #3764
- Fix example in docs/crud/#create-many by @adamzapasnik in #3770
- entc/gen: nillable update setters for non-optional fields by @a8m in #3788
- dialect/entsql: add helper function for creating table annotation by @a8m in #3816
- doc/md: drop v10 support and add v15 for PostgreSQL by @oinume in #3806
- dialect/entsql: add schema to package annotation by @a8m in #3817
- dialect/sql/schema: add table schema by @a8m in #3818
- dialect/atlas: initial work for multi-schema migration using atlas by @a8m in #3821
- doc: add multi-schema migrations using atlas by @a8m in #3825
Full Changelog: v0.12.0...v0.12.5
v0.11.0
We're very happy to announce the release of the next version of Ent: v0.11 🎊
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.
What's Changed
- dialect/sql/schema: add name to versioned migration files by @imhuytq in #2375
- schema/field: expose RType.Implements method by @a8m in #2379
- entc/gen: set Ref and Inverse for edge contains both From and To by @a8m in #2380
- dialect/sql/schema: add method to create a named versioned migration … by @masseelch in #2385
- entc/integration: additional schema changes for migration by @a8m in #2403
- dialect/sql/schema: upgrade atlas and disable sum file creation by @masseelch in #2400
- dialect/sql: avoid passing bool arguments on bool predicates by @a8m in #2405
- entc/gen: move column default quoting to template by @a8m in #2406
- dialect/sql: without foreign keys option for atlas by @zeevmoney in #2404
- all: drop 1.16 support and run CI on 1.17 and 1.18 by @masseelch in #2411
- entc/gen: move select and group builders' scan functions to shared struct by @a8m in #2412
- Update schema-def to use proper method by @fgm in #2416
- Update getting-started.md by @fgm in #2414
- entc/gen: use join for loading m2m relationship by @a8m in #2417
- entc/integration/custom_id: update atlas and fix issue in integration tests by @a8m in #2424
- dialect/sql/schema: skip creating unique key for primary keys by @a8m in #2425
- dialect/sql: add support for window functions by @a8m in #2431
- dialect/sql/schema: prefix sqlite unique indexes with table name by @a8m in #2433
- entc/gen: allow adding extra fields to the generated edges by @a8m in #2437
- update example import by @cjraa in #2432
- Fix incorrect Go code in GoType() doc comments by @fgm in #2441
- dialect/sql: support for order by expressions in window functions by @a8m in #2442
- entc/gen: block Optional on the ID field by @giautm in #2443
- gen/entc/template: add option to process nodes after query using external templates by @a8m in #2444
- dialect/sql/schema: init db version before executing diff by @CharlesGe129 in #2440
- entc/gen: add the sql/execquery feature flag by @a8m in #2447
- entc/integration/migrate: update atlas and test custom time precision by @a8m in #2462
- dialect/sql/schema: option to enable atlas sum file by @masseelch in #2470
- entc/gen: expose config on generated filters by @a8m in #2473
- entc/gen: skip
Table()
predicate and warn about reserved schema name (Client
) by @masseelch in #2486 - entc/integration/migrate: add example for renaming columns by @a8m in #2496
- entc/integration/json: add example for using interfaces in JSON fields by @a8m in #2497
- gen/template: allow overriding of client struct and initialization by @masseelch in #2503
- dialect/sql: add New method to pass in a river without opening a *sql… by @masseelch in #2504
- dialect/sql: support string based pk for mysql56 indexes (prevent err… by @masseelch in #2506
- entc/gen/template/sql/feature: add comment to feature field on config… by @masseelch in #2515
- Fix propagating post-save mutations by @booleangate in #2525
- dialect/sql/schema: respect sumfile when present and do not operate on checksum mismatch by @masseelch in #2522
- Sub queries by @crossworth in #2509
- entc/gen: add conditional-write option to external templates by @a8m in #2542
- go: update ariga.io/atlas to latest master by @a8m in #2555
- feat: add Nil/NotNil predicates by @giautm in #2556
- ent: initial support for edge schemas by @a8m in #2560
- go: update ariga.io/atlas to latest master by @a8m in #2567
- update sqlite3 driver from 1.14.10 to 1.14.13 by @stoikheia in #2566
- entc/gen: avoid setting the incremental attribute fo non-integer fields by @a8m in #2571
- dialect/sql: fixed wrong UserDefined checks by @giautm in #2572
- dialect/sql/sqlgraph: better support for update nodes with predicates by @a8m in #2574
- entc/gen: support indexing edge schema with composite primary keys by @a8m in #2578
- ci: bump golangci-lint version by @sashamelentyev in #2577
- Do not refer to SQLite3 anymore by @frederikhors in #2593
- entc/gen: move a8m/entclean logic to ent by @a8m in #2612
- refactor: rename annotation vars by @sashamelentyev in #2614
- Use
fmt.Errorf
instead oferrors.Wrapf
by @frederikhors in #2608 - entc/gen: change codegen signature from entc to ent by @a8m in #2627
- Fix compile error caused by entc template when Entity name has initials TX by @hax10 in #2633
- dialect/sql/schema: introduce type store interface by @masseelch in #2636
- feat: improve generated comments by @willbicks in #2632
- entc/gen: fixed unnamed field initialization by @giautm in #2648
- dialect/sql/schema: file based type store by @masseelch in #2644
- go: update atlas and test for global-unique-id migration by @a8m in #2661
- entc/gen: catch constraint failures in delete operations by @a8m in #2664
- entc/gen: allow opening and testing concurrent enttest clients by @a8m in #2665
- ci: remove unnecessary build flag from go test by @a8m in #2672
- entc/gen: use gotype pkgname as alias in case it does not match pkgpath by @a8m in #2686
- Update comment typo in group.go by @seawolf in #2687
- entc/gen: support default id values for edge schemas by @a8m in #2688
- Add info about using
WhereInput
in with.Where()
by @frederikhors in #2691 - schema/field: support for sensitive json fields by @a8m in #2701
- dialect/sql/schema: setup tables before running migrate diff by @a8m in #2703
- improve multi-tenancy example and documentation by @a8m in #2705
- entc/gen: skip nodes with composite id types on default id-type detection by @a8m in #2708
- entc: cleanup defaults ID by @giautm in #2709
- dialect/sql/sqlgraph: support edge-schema in upsert by @a8m in #2714
- Fix problem when model maps integer id to a GoType by @stoikheia in #2657
- dialect/sql/schema: atlas engine is now default by @masseelch in #2698
- dialect/sql/sqlgraph: handle edge schema in batch inserts by @a8m in #2718
- entc/gen: ignore edge-fields order in edge-schema with composite identifiers by @a8m in #2719
- entc/gen: improve edge-schema updates by @a8m in #2726
- all: update atlas by @masseelch in #2739
- dialect/sql/builder: make sql.In() with empty args fallback to False() by @Liooo i...
v0.10.1
Version v0.10.1 includes 2 fixes for bugs that were introduced in version v0.10.0, and additional improvements for schema migration.
What's Changed
- entc/gen: set foreign-key columns non-nullable for required edges by @a8m in #1703
- schema/field: add support for type-aware Default and UpdateDefault in time fields by @a8m in #2289
- sql: add support for DESC indexes using annotation and atlasgo.io by @a8m in #2304
- entc/gen: support local package names for generated packages by @a8m in #2306
- Add check that model file doesn't already exist on ent init by @adayNU in #2307
- Allow ID to use field.Other with custom types by @crossworth in https://github.com/ent/ent/pull/2309ent/ent/pull/2336
- entc/gen: skip *sql.NullInt64 assertion on edges with type Other by @crossworth in #2335
- dialect/sql/schema: support postgres geometric types. by @tprebs in #2340
- dialect/sql/schema: versioned migrations by @masseelch in #2337
- entc/gen: singularize feature flag name for versioned migrations by @masseelch in #2350
- dialect/entsql: add support for index-type annotation by @a8m in #2353
- Add required json1 build tag to contributing instructions. by @freb in #2359
- dialect/sql/schema: fix bug in atlas integration when working WithDropIndex/WithDropColumn by @a8m in #2374
New Contributors
- @iamnande made their first contribution in #2274
- @hezhizhen made their first contribution in #2301
- @eric-yoo made their first contribution in #2313
- @crossworth made their first contribution in #2309
- @sbs2001 made their first contribution in #2326
- @MrParano1d made their first contribution in #2332
- @tprebs made their first contribution in #2340
Full Changelog: v0.10.0...v0.10.1
v0.10.0
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.
What's Changed
- dialect/sql/sqlgraph: avoid creating tx blocks for single statement create operation by @a8m in #1858
- go: upgrade to 1.17 by @a8m in #1859
- Goodbye bindata by @a8m in #1860
- fix: error message for the missing fk constraints by @dakimura in #1861
- added MaxLen built-in validator to
[]byte
by @hedwigz in #1863 - Bytes min len by @hedwigz in #1867
- Added
NotEmpty()
to[]byte
by @hedwigz in #1869 - entc/integration: add example for embedding ent.T in Scan by @a8m in #1870
- website/blog: fix gofmt in entviz blog by @a8m in #1877
- schema/field: Fix annotations doc example by @msal4 in #1878
- schema/field: add codegen header for template by @a8m in #1879
- dialect/sql/sqlgraph: avoid creating tx blocks for single DELETE statements by @a8m in #1881
- md/fields:enum-types-typo by @yonidavidson in #1887
- entc/integ: test adding filters to UpdateOne from mutation by @a8m in #1889
- refactor(entc/integration): change
Save
toExec
in create operation by @RiskyFeryansyahP in #1891 - refactor(entc/integration): change Save to Exec in create operation by @RiskyFeryansyahP in #1896
- website/blog: ent joins the linux foundation by @a8m in #1897
- all: replace save with exec when the model is not needed by @a8m in #1901
- entc/integration: fix gremlin server version by @seiichi1101 in #1808
- Custom predicate example for LIKE operator by @sadmansakib in #1911
- all: add (*testing.B).ReportAllocs() to all benchmarks by @odeke-em in #1919
- entc/gen: add schema type to generated validation errors by @a8m in #1924
- website: add link to ent discord server by @a8m in #1930
- dialect/sql/sqlgraph: avoid creating tx blocks for single UPDATE statements by @a8m in #1937
- Link to non-foreign-key join-table fields GH issue by @bbkane in #1912
- dialect/sql/schema: revert #1547 for mariadb by @a8m in #1946
- entc/gen: fix fk handling for bytes by @tarrencev in #1947
- dialect/sql: use raw 0 in COALESCE function on Add calls by @a8m in #1954
- dialect/sql: add Add method to UpdateSet by @a8m in #1955
- entc/gen: support de/incrementing values on upsert by @a8m in #1956
- dialect/sql/schema: skip parsing expression default for postgres by @a8m in #1967
- Unique Field Selection - Merge #1959 by @a8m in #1968
- entc/gen: allow distinct in sqlQuery to enable distinct work in Select() by @EndlessIdea in #1959
- feat(dialect): support mediumtext by @storyicon in #1972
- entc/integ: move docker-compose to top directory by @a8m in #1975
- entc/gen: allow spaces in enum fields by @a8m in #1977
- entc/gen: fix bug with enum separators by @a8m in #1978
- Add Sensitive() option to bytesBuilder by @evanlurvey in #1982
- Update tutorial-grpc-setting-up.md by @attackordie in #1984
- dialect/sql/sqlgraph: support sql.Scanner types when scanning IDs by @a8m in #1987
- entc/integration: add example for bytes id with custom comparable Go types by @a8m in #1998
- dialect: fix godoc for Driver by @a8m in #2002
- dialect/sql/schema: make Field.Unique and Index.Unique equal by @a8m in #2004
- entc/integration: add postgres14 for integration/ci tests by @a8m in #2006
- postgres dialect should support other data type like tstzrange and interval by @ThinkontrolSY in #2013
- Remove deprecated linter by @sashamelentyev in #2017
- all: fix linting issues before migrating to golangci v1.42 by @a8m in #2019
- Bump golangci-lint version by @sashamelentyev in #2018
- entc/gen: ignore immutable fields on Upsert.UpdateNewValues by @a8m in #2011
- fix govet by @sivchari in #2021
- entc/gen: fix example code in comment by @mookjp in #2025
- #2026
- Update 2021-10-11-generating-ent-schemas-from-existing-sql-databases.md by @rotemtam in #2029
- entc/integ: add example for o2o with edge field by @a8m in #2030
- dialect/sql: wrap the sql.Rows with ColumnScanner interface by @a8m in #2001
- website/blog: introducing entcache post by @a8m in #2034
- website/blog: minor fix to the entcache post by @a8m in #2035
- entc/gen: support count with field selection by @a8m in #2037
- blog/entviz: add import on entc.go snippet by @hedwigz in #2040
- entc/gen/integ: add example for using query modifiers in multischema mode by @a8m in #2041
- add read-write separation example by @lenuse in #2032
- Add link to ent/bug by @hilakashai in #2045
- Fix typo by @hilakashai in #2047
- ent/blog: sqlcomment blog post by @hedwigz in #2043
- dialect/sql: add example to SIMILAR TO predicate by @a8m in #2055
- add popular extensions by @hilakashai in #2054
- schema/field: support default values for json and other by @a8m in #2056
- dialect/sql: escape special characters in pattern matching by @a8m in #2062
- dialect/sql/sqlgraph: use selector's column instead of table's column by @timoha in #2060
- entc/gen: introduce the entc.Dependency option by @a8m in #2066
- Update tutorial-todo-gql-mutation-input.md by @freb in #2063
- Remove unused named return by @sashamelentyev in #2069
- Fix typo in tutorial-grpc-generating-proto.md by @heliumbrain in #2082
- entc/gen: support merging dep annotations by @a8m in #2081
- entc/gen: fix module version extraction when running entc as a package by @a8m in #2086
- website/blog: sync objects in external databases by @a8m in #2099
- website/blog: minor typo change by @a8m in #2100
- dialect/sqltest: ensure predicates can be reused by @a8m in #2101
- dialect/sqltest: use postgres dialect in predicate tests by @a8m in #2104
- entc/gen/mutation: add IDs method for mutations by @a8m in #2105
- dialect/sql/sqlgraph: minor refactor changes by @a8m in #2114
- dialect/sql/schema: support mediumtext field in migration by @a8m in #2115
- entc/gen: allow scanning nil valuescanner types directly from database by @a8m in #2117
- entc/gen: minor codegen improvements by @a8m in #2119
- dialect/sql/sqljson: support comparing values with null literals by @a8m in #2125
- dialect/sql/sqljson: fix sqlite haskey and add docs by @a8m in #2128
- dialect/sql: use identifier qualifiers for WHERE clause on upsert by @a8m in #2131
- Update gRPC Documentation for Service Method Generation Options by @JeremyV2014 in #2134
- Getoutreach grevych/sqljson pattern matching predicates by @a8m in #2137
- dialect/sql: add pattern matching predicates for json values by @grevych in #1794
- entc/integration: minor changes for test cases by @a8m in #2148
- ent/doc: load github buttons from cdnjs by @hedwigz in #2151
- Update 2021-09-10-openapi-generator.md by @mattn in #2154
- Fix entql generation for ID types of Bytes, etc. by @adayNU in #2157
- dialect/sql: calling Update.Add after Update.Set should append expression by @a8m in #2168
- entc/gen: add support for subtracting ...
v0.9.1
v0.9.0
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
- Support standard numeric operations for custom Go numeric types.
- Introduce the new
entc.Extension
API. - Add feature flag for the row level locking API. See blog post 🎉.
- Support creating "helper templates" when using custom templates.
- Add
Exec
andExecX
to Create/CreateBulk builders. - Add support for UpsertOne and UpsertBulk 🥳.
- Allow users to provide custom functions to group-by edge.
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
(andNOT 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
andPrefixColumns
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 🙏
v0.8.0
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/[email protected]
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.
v0.7.0
This release contains 1 major feature, small improvements and bug fixes to ent codegen and its runtime, and an experimental integration with protobuf.
Global
- Add support for edge-fields/foreign-keys in the schema (#1213) - Thanks @alexsn, @rubensayshi, @marwan-at-work, @adayNU, @aight8 and @errorhandler for the feedback and helping designing this feature properly.
Please read more about it here - Thanks @rotemtam for the blog-post 🙏 . - Small change to all codebase. Wrap errors (replace
%v
with%w
) when it's useful - Thanks @mgabeler-lee-6rs
Code Generation
- The generated
ent.IsConstraintError
function catches now FK constraint violations (#1316) - Thanks @rotemtam - The
edge.Annotation
provides a way to override the struct-tag for theEdges
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.
Schema
- Add support for
DefaultFunc
in user-defined PKs (#1290) - Add support for MySQL spatial types in migration and add example for it - a8m/entspatial
Contrib
- OSS entproto. An experimental package for generating
.proto
files from ent/schema.
CLI
Thanks @kercylan98, @HarikiRito, @SogoCZE, @wenj91 for reporting issues and being involved in the project.
v0.6.0
New import path 🎊
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' {} +
schema/fields
- Add
DefaultFunc
option for fields (#1153)
entc/gen
-
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"`
dialect/sql/schema
- Add support for migration hooks/middleware (Thanks @rubensayshi)
dialect/sql/sqlgraph
- Apply predicate on update-node
Besides these, there are multiple bug fixes and small perf improvements in this release.