ent

An entity framework for Go

APACHE-2.0 License

Stars
15.1K
Committers
224

Bot releases are hidden (Show)

ent - v0.12.5 Latest Release

Published by a8m 11 months ago

What's Changed

Full Changelog: https://github.com/ent/ent/compare/v0.12.0...v0.12.5

ent - v0.11.0

Published by a8m over 2 years ago

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

New Contributors

Full Changelog: https://github.com/ent/ent/compare/v0.10.1...v0.11

ent - v0.10.1

Published by a8m over 2 years ago

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

New Contributors

Full Changelog: https://github.com/ent/ent/compare/v0.10.0...v0.10.1

ent - v0.10.0

Published by a8m over 2 years ago

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

New Contributors

Full Changelog: https://github.com/ent/ent/compare/v0.9.1...0.10.0

ent - v0.9.1

Published by a8m about 3 years ago

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:

ent - v0.9.0

Published by a8m about 3 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 πŸ™

ent - v0.8.0

Published by a8m over 3 years ago

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 from func (*sql.Selector, func() bool) to func (*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 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).
  • Add database cascading deletion support to edge annotations. See FK annotation.
  • Add support for custom DEFAULT clauses using entsql.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.

ent - v0.7.0

Published by a8m over 3 years ago

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 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.

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

  • ent init now creates a `generate.go file that matches Go 1.16 (#1300) - Thanks @uta-mori

Thanks @kercylan98, @HarikiRito, @SogoCZE, @wenj91 for reporting issues and being involved in the project.

ent - v0.6.0

Published by a8m over 3 years ago

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

dialect/sql/sqlgraph

  • Apply predicate on update-node

Besides these, there are multiple bug fixes and small perf improvements in this release.

ent - v0.5.4

Published by a8m almost 4 years ago

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.

schema/field

  • Support for indexing ID fields (Thanks @napei)
  • Allow non incremental PKs (Thanks @saantiaguilera)
  • Add DefaultFunc option to string and bytes builders
  • Remove the deprecated ValueMap option for enum builder

codegen

  • Allow field selection in query builder and eager-loading (#1077)

dialect/sql/schema

  • Add migration support for JSON columns in old versions of MariaDB (=< 10.2)
  • Support for binary columns in MySQL (Thanks @nolotz)

dialect/sql/sqlgraph

  • Small perf improvements
  • Allow arbitrary last insert id type (Thanks @cliedeman)

dialect/sql

  • Add schema options for sql builders (Thanks @marwan-at-work)
ent - v0.5.3

Published by a8m almost 4 years ago

v0.5.3 is a small release for fixing schema annotations when they are defined both in mixin.Schema and ent.Schema.

ent - v0.5.2

Published by a8m almost 4 years ago

We release this version although it's quite small, in order to provide a stable version for supporting JSON fields migration in MariaDB.

entql

  • Add support for driver.Valuer in typed predicates

dialect/sql/schema

  • Support JSON fields migration for MariaDB

Misc

  • Small changes and improvements for the runtime code
ent - v0.5.1

Published by a8m almost 4 years ago

cmd/ent

  • Replace entc to ent - #989

dialect/entsql

  • Add support for table options in ent/schema (#925)
  • Add Size annotation (#947)

dialect/sql/sqlgraph

  • Improve perf for UpadteMany operations.

dialect/sql/schema

  • Add support for PostgreSQL net types
  • Allow migrations from integer columns to string
ent - v0.5.0

Published by a8m almost 4 years ago

This version contains multiple bug fixes and perf improvements, but also includes a major feature which is the privacy support and additional small features for ent/schema and code-generation.

schema

dialect/sql/schema

  • Add the WithForeighKeys option to migrate
  • Properly handle indexes of tables with uncountable name (#828)
  • Apply size-check only if it is defined in schema (#855)

dialect/sql/sqljson

  • Initial work for json_contains predicate

dialect/sql

  • Add Left/Right join for the SQL builder

entc/gen:

  • Add gen.Template for ent extensions
  • Rename generated FirstXID to FirstIDX
  • Add hook.FixedError helper

entc/internal

  • Add feature-flag support for code-generation (allow opt-in to specific features)
  • Support schema versioning (#852)
ent - v0.4.3

Published by a8m about 4 years ago

entc/gen (codegen)

  • Add an option for clearing non-unique edges.
  • Add validators on group-by and order-by arguments.
  • Add templates for supporting custom predicates in codegen (#758).
  • Improve API for custom templates (add an option for passing template.FuncMap for template execution).

dialect/sql

  • Add an experiment package for supporting JSON predicates at runtime named sqljson. In the future, JSON predicates will be added to the generated predicates.

schema migration

  • Change the WithFixture default value to be false. It's likely to be removed in the upcoming versions. Users that migrate from v0.0.1, directly to v0.4.3, should pass WithFixture(true) on migration.

misc

ent - v0.4.2

Published by a8m about 4 years ago

Small release with a few bug fixes and the following schema changes:

ent/schema

  • Added support for setting default values for fields with a custom GoType.
  • The Enum.NamedValues method was added to replace Enum.ValueMap.
ent - v0.4.0

Published by a8m about 4 years ago

The repository was migrated from facebookincubator to facebook organization.

ent - v0.3.0

Published by a8m about 4 years ago

This version includes multiple bug fixes, changes in ent/schema, the generated-code and the database migration.

Schema changes

  • Add schema annotations support for fields and edges. This API allows to attach metadata to fields and edges and inject them to external templates. More info can be found in the docs.
  • Add GoType support for enum fields. This change makes it possible to share the same enum type between multiple schemas.
  • Add the Unique option to UUID fields.

Codegen changes

  • Add an API for creating bulk of entities. More info can be found in the docs.
  • Add the fail function to template functions.
  • Import codegen out (makes goimports faster).

Migration changes

  • Fix default value option to enum fields.
  • Change ent_types table id type to uint64 (from int).
ent - v0.2.7

Published by a8m over 4 years ago

Codegen changes

The OnlyXID method was renamed to OnlyIDX (breaking changes).

ent - v0.2.6

Published by a8m over 4 years ago

Ent changes:

  • Add OldField to the ent.Mutation interface

Schema changes:

  • Add the Unique option to UUID fields

SQL runtime changes:

  • Minor bug fixes: #561, #587, etc
  • Initial work for batch inserts

Codegen changes:

  • Official release for transaction hooks
  • Add singular finishers for querying primitives, e.g: .String(), .Int(), etc
  • Add condition helpers foe generated hooks
  • Add option to extend existing templates: #583
Package Rankings
Top 8.17% on Proxy.golang.org
Badges
Extracted from project README
Twitter Discord
Related Projects