An entity framework for Go

Overview

ent - An Entity Framework For Go

Twitter

English | 中文

Simple, yet powerful entity framework for Go, that makes it easy to build and maintain applications with large data-models.

  • Schema As Code - model any database schema as Go objects.
  • Easily Traverse Any Graph - run queries, aggregations and traverse any graph structure easily.
  • Statically Typed And Explicit API - 100% statically typed and explicit API using code generation.
  • Multi Storage Driver - supports MySQL, PostgreSQL, SQLite and Gremlin.
  • Extendable - simple to extend and customize using Go templates.

Quick Installation

go get entgo.io/ent/cmd/ent

For proper installation using Go modules, visit entgo.io website.

Docs and Support

The documentation for developing and using ent is available at: https://entgo.io

For discussion and support, open an issue or join our channel in the gophers Slack.

Join the ent Community

In order to contribute to ent, see the CONTRIBUTING file for how to go get started. If your company or your product is using ent, please let us know by adding yourself to the ent users page.

For updates, follow us on Twitter at https://twitter.com/entgo_io

About the Project

The ent project was inspired by Ent, an entity framework we use internally. It is developed and maintained by a8m and alexsn from the Facebook Connectivity team. It is used by multiple teams and projects in production, and the roadmap for its v1 release is described here. Read more about the motivation of the project here.

License

ent is licensed under Apache 2.0 as found in the LICENSE file.

Issues
  • WIP: SQLite3 support for migrations

    WIP: SQLite3 support for migrations

    This is a basic start, a lot of cut and paste but it does pass some very basic tests now. I still have more work to do but I was hoping we could discuss some of it as it arrives, so here's the PR.

    CLA Signed 
    opened by erikh 32
  • proposal: add support for relation/edge schema

    proposal: add support for relation/edge schema

    This is a feature that I have wanted to add for a long time to ent, and will be happy to get feedback, suggestion for improvements or just hear your thoughts before I create a proper PR for it.

    The idea is instead of adding a completely new API for adding fields for edges (columns for join tables), configure their indexes, hooks, privacy, etc, or even support multi-column PKs, we'll add 2 new small changes for the ent/schema for supporting all those issues.

    field.ID Annotation

    A new field.ID option will be added to the schema/field package, and this will allow configuring multi-column PKs, but more than that, it will make it possible to configure relation/edge schema manually. For example:

    // UserGroup defines the UserGroup relation schema.
    type UserGroup struct {
    	ent.Schema
    }
    
    func (UserGroup) Annotations() []schema.Annotation {
    	return []schema.Annotation{
    		// This will generate the following struct:
    		//
    		//	type UserGroupID struct {
    		//		UserID, GroupID int
    		//	}
    		//
    		field.ID("user_id", "group_id"),
    	}
    }
    
    func (UserGroup) Fields() []ent.Field {
    	return []ent.Field{
    		field.Int("user_id"),
    		field.Int("group_id"),
    		field.Time("created_at").
    			Immutable().
    			Default(time.Now),
    	}
    }
    
    func (UserGroup) Edges() []ent.Edge {
    	return []ent.Edge{
    		edge.To("user", User.Type).
    			Unique().
    			Field("user_id"),
    		edge.To("group", Group.Type).
    			Unique().
    			Field("group_id"),
    	}
    }
    

    Indexes, hooks, privacy, and all other options will also be available for this type of schema, but in order to add a user to a group, the flow is a bit longer:

    a8m := client.User.Create().SetName(..).SaveX(ctx)
    hub := client.Group.Create().SetName(..).SaveX(ctx)
    // Instead of calling hub.AddGroups(a8m), the API is:
    client.UserGroup.Create().SetUserID(a8m.ID).SetGroupID(hub.ID).ExecX(ctx)
    client.UserGroup.GetX(ctx, ent.UserGroupID{UserID: a8m.ID, GroupID: hub.ID})
    

    We can bypass this long flow by providing an additional config option for edges:

    The edge.Through Option

    The Through option is supported by other frameworks and has already been proposed here before. The idea is to allow schemas that use the relation/edge-schema to CRUD directly their relations. However, I have an open question (atm) regarding the design of the generated code.

    The configuration looks as follows:

    func (Group) Edges() []ent.Edge {
    	return []ent.Edge{
    		edge.To("users", User.Type).
    			Through(UserGroup.Type),
    	}
    }
    

    And the generated API is as follows:

    a8m := client.User.Create().SetName(..).SaveX(ctx)
    hub := client.Group.Create().SetName(..).AddUsers(a8m).SaveX(ctx)
    

    An open question I have is on how do we set/update relation-schema fields in case they don't have default values or hooks configured on their ent/schema.

    Thoughts?

    Proposal 
    opened by a8m 26
  • entgql: generate graphql and relay objects

    entgql: generate graphql and relay objects

    As part of the effort started by @cliedeman and @giautm on https://github.com/ent/contrib/pull/235, I propose breaking it into smaller tasks and pushing it upstream gradually. We should start with the most common and requested option - generating GraphQL objects from an Ent schema. I suggest starting with the following but would love to hear if you think we should add more.

    Stage 1:

    Schema-levlel annotation

    • Generate basic GraphQL objects (type T), allow configuring its name, directives, implemented interfaces, and its exported fields.
    • Generate Relay Connection objects and the rest of the types supported by https://entgo.io/docs/tutorial-todo-gql-paginate/
    • Auto-update gqlgen config file

    Project-levlel annotation (entc.go)

    • Allow generating types like interfaces or types that are globally used and not specific to a schema.

    Stage 2:

    • Allow configuring mutations (actions) and their inputs on the schema-level and generate both gql and ent code for them.
    • Generate queries.

    Implementation ideas

    I really like the entgql.RelayConnection option defined in https://github.com/ent/contrib/pull/235, but for the types, I think we should make it more customized.

    1. Auto-generate GraphQL and Relay types, but skip fields that are marked with Skip.

    func (Pet) Annotations() []schema.Annotation {
    	return []schema.Annotation{
    		entgql.Type()
    		entgql.RelayConnection(),
    	}
    }
    
    func (Pet) Fields() []ent.Field {
    	return []ent.Field{
    		// ...
    		field.String("name").
    			Annotation(entgql.Skip()),
    	}
    }
    

    2. More control on the generated model and fields.

    func (Pet) Annotations() []schema.Annotation {
    	return []schema.Annotation{
    		entgql.Type("GQLType").
    			Directive(...).
    			Comment(...).
    			Implemented(...)
    		entgql.RelayConnection(),
    	}
    }
    
    func (Pet) Fields() []ent.Field {
    	return []ent.Field{
    		// ...
    		field.String("name").
    			Annotation(
    				entgql.Field("gql_name").
    					Comment(...),
    			),
    	}
    }
    

    3. Allow free mapping.

    func (Pet) Annotations() []schema.Annotation {
    	return []schema.Annotation{
    		entgql.Type("GQLType").
    			Fields(
    				entgql.MapField("gql_field1", "<edge or field name>").
    					Comment(...),
    				entgql.MapField("gql_field2", "<edge or field name>").
    					Directive(...),
    				// ...
    			),
    		entgql.RelayConnection(),
    	}
    }
    

    I have drafts for stage-2, but let's focus on stage-1 first. Thoughts?

    cc @crossworth, @giautm, @cliedeman, @rotemtam, @masseelch, @yonidavidson, @maaft

    Proposal graphql 
    opened by a8m 24
  • entc/gen: add support for edge-fields (foreign-keys)

    entc/gen: add support for edge-fields (foreign-keys)

    Update

    Please see https://entgo.io/docs/schema-edges/#edge-field for full docs.


    Add an API for loading and getting the FKs of ent models, and gate it with feature-flag.

    This change adds a new method on each <T>Query (with FKs on its table) named WithFK() for loading the FKs together with all other fields. However, if users want to select specific fields, they can use Select(...) for selecting any field (including FK). For example:

    pets, err = client.Pet.Query().
    	WithFKs().
    	All(ctx)
    
    pets, err = client.Pet.Query().
    	Select(pet.FieldName, pet.ForeignKeys...).
    	All(ctx)
    

    Also, for each field-edge (an edge with FK), we generate a new method (e.g. OwnerID() (int, error)), that returns the value of the foreign-key, or an error if it wasn't loaded on query or wasn't found (was NULL in the database). For example:

    owner, err := luna.OwnerID()
    

    Next steps (in future PRs) are to add the Select option also to mutations (e.g. Pet.Update()) and predicates for simplifying queries:

    pets, err := client.Pet.Query().
    	Where(pet.OwnerID(id)).
    	All(ctx)
    

    Please share you feedback. Thanks cc @aight8 @errorhandler @Siceberg @rubensayshi

    CLA Signed 
    opened by a8m 20
  • Feature Request: Upsert

    Feature Request: Upsert

    Is it possible to have atomic upsert functionality similar to postresql's INSERT ON CONFLICT or mysql's INSERT ON DUPLICATE KEY UPDATE statement? Use case is to save roundtrips on remote databases and to minimize lines of code.

    FeatureRequest 
    opened by mk0a1a 20
  • ent/circleci: store go tests metadata (#1527)

    ent/circleci: store go tests metadata (#1527)

    Summary: Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1527

    See https://circleci.com/blog/level-up-go-test-with-gotestsum/ for more info

    Differential Revision: D17761305

    CLA Signed Merged 
    opened by alexsn 20
  • internal error: package

    internal error: package "context" without types was imported from "entgo.io/ent"

    I don't figure out yet but latest package does not work on my environment.

    • [x] The issue is present in the latest release.
    • [x] I have searched the issues of this repository and believe that this is not a duplicate.

    Current Behavior 😯

    ent generate ent
    

    output

    internal error: package "context" without types was imported from "entgo.io/ent"
    

    Expected Behavior 🤔

    finish with successfully

    Steps to Reproduce 🕹

    Steps:

    1. just do ent generate ent

    Your Environment 🌎

    | Tech | Version | | ----------- | ------- | | Go | go version devel go1.18-17980dff36 Wed Nov 10 05:08:25 2021 +0000 windows/amd64 | | Ent | latest commit | | Database | SQLite3 | | Driver | https://github.com/mattn/go-sqlite3 |

    opened by mattn 19
  • entgql: Noder doesn't support UUID Types

    entgql: Noder doesn't support UUID Types

    Super excited to see ent support gqlgen (although I understand it's still early on :))

    I was giving it a spin this evening and noticed when trying to create a model using uuid.UUID as the ID type, I got a bunch of type errors in some of the generated code.

    ent/node.go:51:3: cannot use c.ID (type uuid.UUID) as type int in field value
    ent/node.go:86:3: cannot use u.ID (type uuid.UUID) as type int in field value
    ent/node.go:190:21: cannot use id (type int) as type uuid.UUID in argument to testmodel1.ID
    ent/node.go:199:17: cannot use id (type int) as type uuid.UUID in argument to testmodel2.ID
    ent/pagination.go:450:18: cannot use c.ID (type uuid.UUID) as type int in field value
    ent/pagination.go:669:18: cannot use u.ID (type uuid.UUID) as type int in field value
    

    So I changed the generator based from the documentation to use a custom Field TypeInfo to TypeUUID

    // +build ignore
    
    package main
    
    import (
    	"log"
    
    	"github.com/facebook/ent/entc"
    	"github.com/facebook/ent/entc/gen"
    	"github.com/facebook/ent/schema/field"
    	"github.com/facebookincubator/ent-contrib/entgql"
    )
    
    func main() {
    	err := entc.Generate("./schema", &gen.Config{
    		Templates: entgql.AllTemplates,
    		IDType: &field.TypeInfo{
    			Type: field.TypeUUID,
    		},
    	})
    	if err != nil {
    		log.Fatalf("running ent codegen: %v", err)
    	}
    }
    

    Which got me a little bit further!

    ent/node.go:180:26: cannot use id (type [16]byte) as type string in argument to strconv.Atoi
    

    Looks like the culprit is located here. As the type of id argument in Noder is [16]byte, this wont work but I'm wondering if there's an easy way to set this as uuid.UUID and use a Stringer interface to call Atoi?

    Thanks!

    opened by tankbusta 19
  • migrations with sqlite3

    migrations with sqlite3

    I have roughly the schema below, and on the second pass of Schema.Create, it gives this stack trace. I notice on the documentation near the trace it says sqlite3 can't be used in "append-only" mode because it's "just for testing". Is that the current state of things? If so I can just change my database targets.

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x957333]
    
    goroutine 1 [running]:
    github.com/facebookincubator/ent/dialect/sql/schema.(*Migrate).changeSet(0xc00011f740, 0x0, 0x10b6c40, 0xc8f660, 0xc00015a860, 0xbb0ea2)
            /usergo/pkg/mod/github.com/facebookincubator/[email protected]/dialect/sql/schema/migrate.go:241 +0x63
    github.com/facebookincubator/ent/dialect/sql/schema.(*Migrate).create(0xc00011f740, 0xc8f460, 0xc0000a0000, 0xc8f660, 0xc00015a860, 0x10b0920, 0x3, 0x3, 0xbd9320, 0xc00011f740)
            /usergo/pkg/mod/github.com/facebookincubator/[email protected]/dialect/sql/schema/migrate.go:121 +0x1b6
    github.com/facebookincubator/ent/dialect/sql/schema.(*Migrate).Create(0xc00011f740, 0xc8f460, 0xc0000a0000, 0x10b0920, 0x3, 0x3, 0x0, 0x0)
            /usergo/pkg/mod/github.com/facebookincubator/[email protected]/dialect/sql/schema/migrate.go:104 +0x11f
    github.com/tinyci/services/service/usersvc/ent/migrate.(*Schema).Create(0xc0000ab6c0, 0xc8f460, 0xc0000a0000, 0x0, 0x0, 0x0, 0x0, 0xc0000d0d80)
            /usergo/src/github.com/tinyci/services/service/usersvc/ent/migrate/migrate.go:48 +0x12a
    

    Schema:

    // User holds the schema definition for the User entity.
    type User struct {
      ent.Schema
    }
    
    // Fields of the User.
    func (User) Fields() []ent.Field {
      return []ent.Field{
        field.String("username").Immutable().Unique(),
        field.String("password"),
        field.Time("created_at").Immutable().Default(time.Now),
        field.Time("updated_at").Default(time.Now),
      }
    }
    
    // Edges of the User.
    func (User) Edges() []ent.Edge {
      return []ent.Edge{
        edge.To("capabilities", Capability.Type),
        edge.To("tokens", AuthToken.Type),
      }
    }
    
    // Capability holds the schema definition for the Capabilities entity.
    type Capability struct {
      ent.Schema
    }
    
    // Fields of the Capabilities.
    func (Capability) Fields() []ent.Field {
      return []ent.Field{
        field.String("capability").Immutable().Unique(),
      }
    }
    
    // Edges of the Capabilities.
    func (Capability) Edges() []ent.Edge {
      return []ent.Edge{
        edge.To("users", User.Type).Unique(),
      }
    }
    
    
    // AuthToken holds the schema definition for the AuthToken entity.
    type AuthToken struct {
      ent.Schema
    }
    
    // Fields of the AuthToken.
    func (AuthToken) Fields() []ent.Field {
      return []ent.Field{
        field.String("service").Immutable(),
        field.String("token").Sensitive(),
        field.Time("created_at").Immutable().Default(time.Now),
        field.Time("expires_at").Immutable().Nillable().Optional(),
      }
    }
    
    // Edges of the AuthToken.
    func (AuthToken) Edges() []ent.Edge {
      return []ent.Edge{
        edge.To("user", User.Type).Required().Unique(),
      }
    }
    
    opened by erikh 19
  • override id column

    override id column

    Is there a way to redeclare the id column as a custom string type?

    If I put the following in my schema:

    field.String("id").Unique()

    The generated code ends up broken because it creates two declarations of "id", but furthermore it ignores the fact that it's a string, and declares it as an integer instead.

    This might be related to the UUID discussions, but it would be great if we can define our own custom primary keys as strings that we provide at runtime.

    opened by marwan-at-work 19
  • How to Generating Versioned Migration Files​ without putting it in main?

    How to Generating Versioned Migration Files​ without putting it in main?

    Can we generate the versioned migration files not in main?

    for example:

    func Open(ctx context.Context, databaseUrl string) *ent.Client {
    	db, err := sql.Open("pgx", databaseUrl)
    	if err != nil {
    		log.Fatalf("failed to open the database", err)
    	}
    
    	// Create an ent.Driver from `db`.
    	drv := entsql.OpenDB(dialect.Postgres, db)
    	client := ent.NewClient(ent.Driver(drv))
    
    	dir, err := migrate.NewLocalDir("migrations")
    	if err != nil {
    		log.Fatalf("failed creating atlas migration directory: %v", err)
    	}
    	// Write migration diff.
    	err = client.Schema.Diff(ctx, schema.WithDir(dir))
    	if err != nil {
    		log.Fatalf("failed creating schema resources: %v", err)
    	}
    
    	return ent.NewClient(ent.Driver(drv))
    }
    
    Question migration 
    opened by christiezhao-outreach 18
  • Invalid imports created when generating code for an object using more than one goType

    Invalid imports created when generating code for an object using more than one goType

    • [x] The issue is present in the latest release.
    • [x] I have searched the issues of this repository and believe that this is not a duplicate.

    might be related to https://github.com/ent/ent/issues/1565

    Current Behavior 😯

    In the attached bug-repo, there are two versioned proto packages :

    • ent_multiple_proto_bug.bar.v1alpha
    • ent_multiple_proto_bug.foo.v1alpha

    The generated code for these libraries end up at the following paths:

    • go package: barv1alpha path: gen/ent-multiple-proto-bug/bar/v1alpha
    • go package: foov1alpha path: gen/ent-multiple-proto-bug/foo/v1alpha

    The ValueScanner interface is implemented for both packages in the *.pb.ent.go files.

    Both packages are used in the ent/schema/user.go object:

    func (User) Fields() []ent.Field {
    	return []ent.Field{
    		field.Int("age"),
    		field.String("name"),
    		field.Bytes("foo").GoType(&foov1alpha.Foo{}),
    		field.Bytes("bar").GoType(&barv1alpha.Bar{}),
    	}
    }
    

    (see: https://github.com/rltvty/ent-multiple-proto-bug/blob/master/ent/schema/user.go for full code)

    After running go generate ./ent, the generated code has invalid imports and will not compile. In all cases, an extra, non-aliased, import of "github.com/rltvty/ent-multiple-proto-bug/gen/ent-multiple-proto-bug/foo/v1alpha" seems to be the issue.

    The following files in the ./ent folder have the issue:

    • mutation.go: https://github.com/rltvty/ent-multiple-proto-bug/blob/master/ent/mutation.go#L14
    • runtime.go: https://github.com/rltvty/ent-multiple-proto-bug/blob/master/ent/runtime.go#L6
    • user_delete.go: https://github.com/rltvty/ent-multiple-proto-bug/blob/master/ent/user_delete.go#L14
    • user_query.go: https://github.com/rltvty/ent-multiple-proto-bug/blob/master/ent/user_query.go#L15
    • user_update.go: https://github.com/rltvty/ent-multiple-proto-bug/blob/master/ent/user_update.go#L16
    • user.go: https://github.com/rltvty/ent-multiple-proto-bug/blob/master/ent/user.go#L12

    Expected Behavior 🤔

    Expected that the generated code doesn't have this extra import statement, and the code can compile.

    if I delete these extra imports, I have confirmed that the code does compile and work as expected

    Steps to Reproduce 🕹

    https://github.com/rltvty/ent-multiple-proto-bug

    | Tech | Version | | ----------- | ------- | | Go | 1.18.3 | | Ent | v0.10.2 |

    opened by rltvty 1
  • 403 Access Denied for blog subscription

    403 Access Denied for blog subscription

    I tried to subscribe to blog using RSS or ATOM but I get errors.

    Manually opened links and I get 403: https://entgo.io/blog/rss.xml | https://entgo.io/blog/atom.xml.

    opened by frederikhors 0
  • Whether there are plans for generic support

    Whether there are plans for generic support

    • [x] I have searched the issues of this repository and believe that this is not a duplicate.

    Motivation 🔦

    1. much of the code is now not reusable.
    2. the same code cannot be accessed through a unified interface due to different types.
    3. I want to add some generic methods for ent.
    opened by godcong 0
  • Validation issues with GRPC when using uppercase values in enums.

    Validation issues with GRPC when using uppercase values in enums.

    Running into an issue with protoc-gen-entgrpc and enums. There is a conversion happening that is lower casing enum values causing a validation error.

    • [x] The issue is present in the latest release.
    • [x] I have searched the issues of this repository and believe that this is not a duplicate.

    Current Behavior 😯

    Given a schema like this:

    field.Enum("device_type").
      Values("GLOWY9000", "SPEEDY300").
      Default("GLOWY9000").
      Annotations(
        entproto.Field(10),
        entproto.Enum(map[string]int32{
          "GLOWY9000": 0,
          "SPEEDY300": 1,
        }),
      ),
    

    It generates a proto file field like this:

      enum DeviceType {
        GLOWY9000 = 0;
    
        SPEEDY300 = 1;
      }
    

    So far so good, but when I try to call the create through GRPC, I get back the following message:

    internal error: entgenerated: validator failed for field "HeelyDevice.device_type": heelydevice: invalid enum value for device_type field: "speedy300"
    

    It seems that there is a ToLower in the plugin's template that is causing the issue. The toEnt function below is returning the lowercase value of the enum.

    func toEntHeelyDevice_DeviceType(e HeelyDevice_DeviceType) heelydevice.DeviceType {
        if v, ok := HeelyDevice_DeviceType_name[int32(e)]; ok {
            return heelydevice.DeviceType(strings.ToLower(v))
        }
        return ""
    }
    

    I'm not sure why this function wants to lower the enum value, but that causes a validation error later on when the object is trying to be saved to the database:

    // DeviceTypeValidator is a validator for the "device_type" field enum values. It is called by the builders before save.
    func DeviceTypeValidator(dt DeviceType) error {
        switch dt {
        case DeviceTypeGLOWY9000, DeviceTypeSPEEDY300:
            return nil
        default:
            return fmt.Errorf("heelydevice: invalid enum value for device_type field: %q", dt)
        }
    }
    

    Expected Behavior 🤔

    The Create function in the generated GRPC service should not fail validation when an uppercase value is used as part of a enum field.

    Steps to Reproduce 🕹

    Steps:

    Your Environment 🌎

    | Tech | Version | | ----------- | ------- | | Go | 1.17.? | | Ent | 0.9.? | | Database | MySQL | | Driver | https://github.com/go-sql-driver/mysql |

    opened by hartmamt 1
  • sql default syntax error

    sql default syntax error

    • [x] The issue is present in the latest release.
    • [x] I have searched the issues of this repository and believe that this is not a duplicate.

    Current Behavior 😯

    https://github.com/wenerme/ent-demo/blob/e2d349bcc4fc5c90e1d3df5bfff22aad9345eb44/ent/schema/mixin_id.go#L91-L106

    type TenantSidMixin struct {
    	mixin.Schema
    }
    
    func (TenantSidMixin) Fields() []ent.Field {
    	return []ent.Field{
    		field.Int("sid").Immutable().Annotations(
    		),
    		field.Int("tid").Immutable().Annotations(
    			// this line failed
    			&entsql.Annotation{Default: "current_setting('tenant.id')::bigint"},
    		),
    	}
    }
    
    panic: sql/schema: modify "service_accounts" table: ERROR: invalid input syntax for type bigint: "current_setting('tenant.id')::bigint" (SQLSTATE 22P02)
    

    Expected Behavior 🤔

    default works as expected

    Steps to Reproduce 🕹

    https://github.com/wenerme/ent-demo/blob/e2d349bcc4fc5c90e1d3df5bfff22aad9345eb44/test/migrate_test.go#L17-L46

    Your Environment 🌎

    | Tech | Version | | ----------- | ------- | | Go | 1.18.1 | | Ent | latest | | Database | postgres | | Driver | pgx |

    opened by wenerme 1
Releases(v0.10.1)
  • v0.10.1(Mar 4, 2022)

    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 https://github.com/ent/ent/pull/1703
    • schema/field: add support for type-aware Default and UpdateDefault in time fields by @a8m in https://github.com/ent/ent/pull/2289
    • sql: add support for DESC indexes using annotation and atlasgo.io by @a8m in https://github.com/ent/ent/pull/2304
    • entc/gen: support local package names for generated packages by @a8m in https://github.com/ent/ent/pull/2306
    • Add check that model file doesn't already exist on ent init by @adayNU in https://github.com/ent/ent/pull/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 https://github.com/ent/ent/pull/2335
    • dialect/sql/schema: support postgres geometric types. by @tprebs in https://github.com/ent/ent/pull/2340
    • dialect/sql/schema: versioned migrations by @masseelch in https://github.com/ent/ent/pull/2337
    • entc/gen: singularize feature flag name for versioned migrations by @masseelch in https://github.com/ent/ent/pull/2350
    • dialect/entsql: add support for index-type annotation by @a8m in https://github.com/ent/ent/pull/2353
    • Add required json1 build tag to contributing instructions. by @freb in https://github.com/ent/ent/pull/2359
    • dialect/sql/schema: fix bug in atlas integration when working WithDropIndex/WithDropColumn by @a8m in https://github.com/ent/ent/pull/2374

    New Contributors

    • @iamnande made their first contribution in https://github.com/ent/ent/pull/2274
    • @hezhizhen made their first contribution in https://github.com/ent/ent/pull/2301
    • @eric-yoo made their first contribution in https://github.com/ent/ent/pull/2313
    • @crossworth made their first contribution in https://github.com/ent/ent/pull/2309
    • @sbs2001 made their first contribution in https://github.com/ent/ent/pull/2326
    • @MrParano1d made their first contribution in https://github.com/ent/ent/pull/2332
    • @tprebs made their first contribution in https://github.com/ent/ent/pull/2340

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

    Source code(tar.gz)
    Source code(zip)
  • v0.10.0(Jan 20, 2022)

    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 https://github.com/ent/ent/pull/1858
    • go: upgrade to 1.17 by @a8m in https://github.com/ent/ent/pull/1859
    • Goodbye bindata by @a8m in https://github.com/ent/ent/pull/1860
    • fix: error message for the missing fk constraints by @dakimura in https://github.com/ent/ent/pull/1861
    • added MaxLen built-in validator to []byte by @hedwigz in https://github.com/ent/ent/pull/1863
    • Bytes min len by @hedwigz in https://github.com/ent/ent/pull/1867
    • Added NotEmpty() to []byte by @hedwigz in https://github.com/ent/ent/pull/1869
    • entc/integration: add example for embedding ent.T in Scan by @a8m in https://github.com/ent/ent/pull/1870
    • website/blog: fix gofmt in entviz blog by @a8m in https://github.com/ent/ent/pull/1877
    • schema/field: Fix annotations doc example by @msal4 in https://github.com/ent/ent/pull/1878
    • schema/field: add codegen header for template by @a8m in https://github.com/ent/ent/pull/1879
    • dialect/sql/sqlgraph: avoid creating tx blocks for single DELETE statements by @a8m in https://github.com/ent/ent/pull/1881
    • md/fields:enum-types-typo by @yonidavidson in https://github.com/ent/ent/pull/1887
    • entc/integ: test adding filters to UpdateOne from mutation by @a8m in https://github.com/ent/ent/pull/1889
    • refactor(entc/integration): change Save to Exec in create operation by @RiskyFeryansyahP in https://github.com/ent/ent/pull/1891
    • refactor(entc/integration): change Save to Exec in create operation by @RiskyFeryansyahP in https://github.com/ent/ent/pull/1896
    • website/blog: ent joins the linux foundation by @a8m in https://github.com/ent/ent/pull/1897
    • all: replace save with exec when the model is not needed by @a8m in https://github.com/ent/ent/pull/1901
    • entc/integration: fix gremlin server version by @seiichi1101 in https://github.com/ent/ent/pull/1808
    • Custom predicate example for LIKE operator by @sadmansakib in https://github.com/ent/ent/pull/1911
    • all: add (*testing.B).ReportAllocs() to all benchmarks by @odeke-em in https://github.com/ent/ent/pull/1919
    • entc/gen: add schema type to generated validation errors by @a8m in https://github.com/ent/ent/pull/1924
    • website: add link to ent discord server by @a8m in https://github.com/ent/ent/pull/1930
    • dialect/sql/sqlgraph: avoid creating tx blocks for single UPDATE statements by @a8m in https://github.com/ent/ent/pull/1937
    • Link to non-foreign-key join-table fields GH issue by @bbkane in https://github.com/ent/ent/pull/1912
    • dialect/sql/schema: revert #1547 for mariadb by @a8m in https://github.com/ent/ent/pull/1946
    • entc/gen: fix fk handling for bytes by @tarrencev in https://github.com/ent/ent/pull/1947
    • dialect/sql: use raw 0 in COALESCE function on Add calls by @a8m in https://github.com/ent/ent/pull/1954
    • dialect/sql: add Add method to UpdateSet by @a8m in https://github.com/ent/ent/pull/1955
    • entc/gen: support de/incrementing values on upsert by @a8m in https://github.com/ent/ent/pull/1956
    • dialect/sql/schema: skip parsing expression default for postgres by @a8m in https://github.com/ent/ent/pull/1967
    • Unique Field Selection - Merge #1959 by @a8m in https://github.com/ent/ent/pull/1968
    • entc/gen: allow distinct in sqlQuery to enable distinct work in Select() by @EndlessIdea in https://github.com/ent/ent/pull/1959
    • feat(dialect): support mediumtext by @storyicon in https://github.com/ent/ent/pull/1972
    • entc/integ: move docker-compose to top directory by @a8m in https://github.com/ent/ent/pull/1975
    • entc/gen: allow spaces in enum fields by @a8m in https://github.com/ent/ent/pull/1977
    • entc/gen: fix bug with enum separators by @a8m in https://github.com/ent/ent/pull/1978
    • Add Sensitive() option to bytesBuilder by @evanlurvey in https://github.com/ent/ent/pull/1982
    • Update tutorial-grpc-setting-up.md by @attackordie in https://github.com/ent/ent/pull/1984
    • dialect/sql/sqlgraph: support sql.Scanner types when scanning IDs by @a8m in https://github.com/ent/ent/pull/1987
    • entc/integration: add example for bytes id with custom comparable Go types by @a8m in https://github.com/ent/ent/pull/1998
    • dialect: fix godoc for Driver by @a8m in https://github.com/ent/ent/pull/2002
    • dialect/sql/schema: make Field.Unique and Index.Unique equal by @a8m in https://github.com/ent/ent/pull/2004
    • entc/integration: add postgres14 for integration/ci tests by @a8m in https://github.com/ent/ent/pull/2006
    • postgres dialect should support other data type like tstzrange and interval by @ThinkontrolSY in https://github.com/ent/ent/pull/2013
    • Remove deprecated linter by @sashamelentyev in https://github.com/ent/ent/pull/2017
    • all: fix linting issues before migrating to golangci v1.42 by @a8m in https://github.com/ent/ent/pull/2019
    • Bump golangci-lint version by @sashamelentyev in https://github.com/ent/ent/pull/2018
    • entc/gen: ignore immutable fields on Upsert.UpdateNewValues by @a8m in https://github.com/ent/ent/pull/2011
    • fix govet by @sivchari in https://github.com/ent/ent/pull/2021
    • entc/gen: fix example code in comment by @mookjp in https://github.com/ent/ent/pull/2025
    • https://github.com/ent/ent/pull/2026
    • Update 2021-10-11-generating-ent-schemas-from-existing-sql-databases.md by @rotemtam in https://github.com/ent/ent/pull/2029
    • entc/integ: add example for o2o with edge field by @a8m in https://github.com/ent/ent/pull/2030
    • dialect/sql: wrap the sql.Rows with ColumnScanner interface by @a8m in https://github.com/ent/ent/pull/2001
    • website/blog: introducing entcache post by @a8m in https://github.com/ent/ent/pull/2034
    • website/blog: minor fix to the entcache post by @a8m in https://github.com/ent/ent/pull/2035
    • entc/gen: support count with field selection by @a8m in https://github.com/ent/ent/pull/2037
    • blog/entviz: add import on entc.go snippet by @hedwigz in https://github.com/ent/ent/pull/2040
    • entc/gen/integ: add example for using query modifiers in multischema mode by @a8m in https://github.com/ent/ent/pull/2041
    • add read-write separation example by @lenuse in https://github.com/ent/ent/pull/2032
    • Add link to ent/bug by @hilakashai in https://github.com/ent/ent/pull/2045
    • Fix typo by @hilakashai in https://github.com/ent/ent/pull/2047
    • ent/blog: sqlcomment blog post by @hedwigz in https://github.com/ent/ent/pull/2043
    • dialect/sql: add example to SIMILAR TO predicate by @a8m in https://github.com/ent/ent/pull/2055
    • add popular extensions by @hilakashai in https://github.com/ent/ent/pull/2054
    • schema/field: support default values for json and other by @a8m in https://github.com/ent/ent/pull/2056
    • dialect/sql: escape special characters in pattern matching by @a8m in https://github.com/ent/ent/pull/2062
    • dialect/sql/sqlgraph: use selector's column instead of table's column by @timoha in https://github.com/ent/ent/pull/2060
    • entc/gen: introduce the entc.Dependency option by @a8m in https://github.com/ent/ent/pull/2066
    • Update tutorial-todo-gql-mutation-input.md by @freb in https://github.com/ent/ent/pull/2063
    • Remove unused named return by @sashamelentyev in https://github.com/ent/ent/pull/2069
    • Fix typo in tutorial-grpc-generating-proto.md by @heliumbrain in https://github.com/ent/ent/pull/2082
    • entc/gen: support merging dep annotations by @a8m in https://github.com/ent/ent/pull/2081
    • entc/gen: fix module version extraction when running entc as a package by @a8m in https://github.com/ent/ent/pull/2086
    • website/blog: sync objects in external databases by @a8m in https://github.com/ent/ent/pull/2099
    • website/blog: minor typo change by @a8m in https://github.com/ent/ent/pull/2100
    • dialect/sqltest: ensure predicates can be reused by @a8m in https://github.com/ent/ent/pull/2101
    • dialect/sqltest: use postgres dialect in predicate tests by @a8m in https://github.com/ent/ent/pull/2104
    • entc/gen/mutation: add IDs method for mutations by @a8m in https://github.com/ent/ent/pull/2105
    • dialect/sql/sqlgraph: minor refactor changes by @a8m in https://github.com/ent/ent/pull/2114
    • dialect/sql/schema: support mediumtext field in migration by @a8m in https://github.com/ent/ent/pull/2115
    • entc/gen: allow scanning nil valuescanner types directly from database by @a8m in https://github.com/ent/ent/pull/2117
    • entc/gen: minor codegen improvements by @a8m in https://github.com/ent/ent/pull/2119
    • dialect/sql/sqljson: support comparing values with null literals by @a8m in https://github.com/ent/ent/pull/2125
    • dialect/sql/sqljson: fix sqlite haskey and add docs by @a8m in https://github.com/ent/ent/pull/2128
    • dialect/sql: use identifier qualifiers for WHERE clause on upsert by @a8m in https://github.com/ent/ent/pull/2131
    • Update gRPC Documentation for Service Method Generation Options by @JeremyV2014 in https://github.com/ent/ent/pull/2134
    • Getoutreach grevych/sqljson pattern matching predicates by @a8m in https://github.com/ent/ent/pull/2137
    • dialect/sql: add pattern matching predicates for json values by @grevych in https://github.com/ent/ent/pull/1794
    • entc/integration: minor changes for test cases by @a8m in https://github.com/ent/ent/pull/2148
    • ent/doc: load github buttons from cdnjs by @hedwigz in https://github.com/ent/ent/pull/2151
    • Update 2021-09-10-openapi-generator.md by @mattn in https://github.com/ent/ent/pull/2154
    • Fix entql generation for ID types of Bytes, etc. by @adayNU in https://github.com/ent/ent/pull/2157
    • dialect/sql: calling Update.Add after Update.Set should append expression by @a8m in https://github.com/ent/ent/pull/2168
    • entc/gen: add support for subtracting values from unsgined fields by @a8m in https://github.com/ent/ent/pull/2169
    • Fix migrating Postgres fields with max character varchar custom type by @naormatania in https://github.com/ent/ent/pull/2162
    • update faq.md, add new question by @idc77 in https://github.com/ent/ent/pull/2183
    • entc/load: add go module info to schema spec by @a8m in https://github.com/ent/ent/pull/2175
    • dialect/sql/schema: fix bug when using multiple table CHECK constraints by @a8m in https://github.com/ent/ent/pull/2188
    • entc/gen: import gen.Config documentation by @a8m in https://github.com/ent/ent/pull/2189
    • dialect/schema: support float for mysql by @yonidavidson in https://github.com/ent/ent/pull/2191
    • entc/gen: don't rely on descriptor when retrieving enum values or nam… by @masseelch in https://github.com/ent/ent/pull/2211
    • dialect/sql: add support for SelectExpr by @a8m in https://github.com/ent/ent/pull/2220
    • convert column type string to lower case by @m3hm3t in https://github.com/ent/ent/pull/2222
    • Default field annotation doesn't change existent column #1758 by @m3hm3t in https://github.com/ent/ent/pull/2199
    • go: update golang.org/x/tools to latest by @a8m in https://github.com/ent/ent/pull/2229
    • dialect/sql: support passing selectors to basic predicates by @a8m in https://github.com/ent/ent/pull/2237
    • Adds blog article for using ent in serverless GraphQL using AWS by @bodokaiser in https://github.com/ent/ent/pull/2206
    • fix(entc/gen): there was a typo in Tx interfaces by @masseelch in https://github.com/ent/ent/pull/2251
    • refactor(all): fix typo by @sashamelentyev in https://github.com/ent/ent/pull/2243
    • dialect/sql/schema: do not sort primary-key columns before diff by @a8m in https://github.com/ent/ent/pull/2254
    • Fix ctx in tx begin by @Laconty in https://github.com/ent/ent/pull/2260
    • dialect/sql/schema: support time with time zone and time without time zone by @s-takehana in https://github.com/ent/ent/pull/2257
    • entc/integration: rename uuid to optional_uuid to allow nillable setters for array types by @a8m in https://github.com/ent/ent/pull/2264
    • Spelling fix in error message by @genevieve in https://github.com/ent/ent/pull/2262
    • UUID nillable setter by @cjraa in https://github.com/ent/ent/pull/2266
    • dialect/sql/sqlgraph: avoid creating tx blocks for single statement batch-create operation by @a8m in https://github.com/ent/ent/pull/2272
    • dialect/sql/schema: hello ariga.io/atlas by @a8m in https://github.com/ent/ent/pull/2279

    New Contributors

    • @dakimura made their first contribution in https://github.com/ent/ent/pull/1861
    • @RiskyFeryansyahP made their first contribution in https://github.com/ent/ent/pull/1883
    • @seiichi1101 made their first contribution in https://github.com/ent/ent/pull/1808
    • @odeke-em made their first contribution in https://github.com/ent/ent/pull/1919
    • @isoppp made their first contribution in https://github.com/ent/ent/pull/1928
    • @s-takehana made their first contribution in https://github.com/ent/ent/pull/1934
    • @bbkane made their first contribution in https://github.com/ent/ent/pull/1912
    • @EndlessIdea made their first contribution in https://github.com/ent/ent/pull/1959
    • @storyicon made their first contribution in https://github.com/ent/ent/pull/1972
    • @evanlurvey made their first contribution in https://github.com/ent/ent/pull/1982
    • @attackordie made their first contribution in https://github.com/ent/ent/pull/1984
    • @posener made their first contribution in https://github.com/ent/ent/pull/2008
    • @ThinkontrolSY made their first contribution in https://github.com/ent/ent/pull/2013
    • @sashamelentyev made their first contribution in https://github.com/ent/ent/pull/2017
    • @sivchari made their first contribution in https://github.com/ent/ent/pull/2021
    • @mookjp made their first contribution in https://github.com/ent/ent/pull/2025
    • @lenuse made their first contribution in https://github.com/ent/ent/pull/2032
    • @hilakashai made their first contribution in https://github.com/ent/ent/pull/2045
    • @freb made their first contribution in https://github.com/ent/ent/pull/2063
    • @heliumbrain made their first contribution in https://github.com/ent/ent/pull/2082
    • @tankbusta made their first contribution in https://github.com/ent/ent/pull/2110
    • @JeremyV2014 made their first contribution in https://github.com/ent/ent/pull/2134
    • @grevych made their first contribution in https://github.com/ent/ent/pull/1794
    • @mattn made their first contribution in https://github.com/ent/ent/pull/2154
    • @naormatania made their first contribution in https://github.com/ent/ent/pull/2162
    • @idc77 made their first contribution in https://github.com/ent/ent/pull/2183
    • @HurSungYun made their first contribution in https://github.com/ent/ent/pull/2186
    • @peanut-cc made their first contribution in https://github.com/ent/ent/pull/2200
    • @m3hm3t made their first contribution in https://github.com/ent/ent/pull/2222
    • @vecpeng made their first contribution in https://github.com/ent/ent/pull/2235
    • @bodokaiser made their first contribution in https://github.com/ent/ent/pull/2206
    • @Laconty made their first contribution in https://github.com/ent/ent/pull/2260
    • @genevieve made their first contribution in https://github.com/ent/ent/pull/2262
    • @cjraa made their first contribution in https://github.com/ent/ent/pull/2266

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

    Source code(tar.gz)
    Source code(zip)
  • v0.9.1(Aug 17, 2021)

    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:

    • https://github.com/ent/ent/pull/1836
    • https://github.com/ent/ent/pull/1827
    • https://github.com/ent/ent/pull/1847
    Source code(tar.gz)
    Source code(zip)
  • v0.9.0(Aug 5, 2021)

    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 🙏

    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Apr 14, 2021)

    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.

    Source code(tar.gz)
    Source code(zip)
  • v0.7.0(Mar 11, 2021)

    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.

    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Feb 2, 2021)

    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.

    Source code(tar.gz)
    Source code(zip)
  • v0.5.4(Jan 6, 2021)

    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)
    Source code(tar.gz)
    Source code(zip)
  • v0.5.3(Dec 13, 2020)

  • v0.5.2(Dec 11, 2020)

    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
    Source code(tar.gz)
    Source code(zip)
  • v0.5.1(Nov 29, 2020)

    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
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Nov 4, 2020)

    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)
    Source code(tar.gz)
    Source code(zip)
  • v0.4.3(Sep 21, 2020)

    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

    • Add the GraphQL integration to ent-contrib, and create a page for it in https://entgo.io/docs/graphql.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.2(Aug 30, 2020)

    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.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Aug 18, 2020)

  • v0.3.0(Aug 5, 2020)

    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).
    Source code(tar.gz)
    Source code(zip)
  • v0.2.7(Jul 16, 2020)

  • v0.2.6(Jul 12, 2020)

    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
    Source code(tar.gz)
    Source code(zip)
  • v0.2.4(Jun 17, 2020)

  • v0.2.3(Jun 9, 2020)

    Schema changes

    2 options were added to the schema fields:

    • SchemaType - an option to override the default database-type used by ent. docs
    • GoType - an option to provide a custom Go type for fields. docs

    Codegen

    A few bug fixes and another option for getting the Mutation object of a builder. More info can be found in the PR.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Apr 20, 2020)

    Add Indexes/Edges/Hooks to ent.Mixin, and also rename schema/schemautil to schema/mixin.

    This means that if you upgrade to v0.2.0 and you used mixins before, you should do the following:

    • If you use one of the mixins in schemautil (like schemautil.TimeMixin), you should replace the import path to be ent/schema/mixin instead (and drop the Mixin suffix).
    • If you use your own mixin, you should embed mixin.Schema in your struct instead of implementing the rest of the methods.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.4(Mar 22, 2020)

  • v0.1.2(Feb 14, 2020)

    integration: update mysql8 version and remove test container integration: add pg and mysql test for customids (#342) doc: fix a doc error (#339) entc/gen: currently handle user-defined string ids (#338) dialect/sql/mysql: fix verifyrange check for mysql (#337) entc/gen: better formatted codegen for predicates (#336) dialect/sql/schema: setrange on custom column name of pks (#333) entc/gen: fix eager-loading for m2m edges (#335) ci: upgrade to mysql latest in integration (#331) dialect/sql/schema: support mysql latest numeric type format (#328) entc/gen: allow defining custom tag for id field (#330) dialect/sql/schema: verify and fix mysql auto-increment on reset (#329)

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Feb 3, 2020)

    #286 addressed the issue that described in #285.

    Although, this PR was heavily tested internally before it was merged, we suggest that if you upgrade an older version of ent, run migration with offline mode before, to make sure it goes smoothly.

    Source code(tar.gz)
    Source code(zip)
Time Series Alerting Framework

Bosun Bosun is a time series alerting framework developed by Stack Exchange. Scollector is a metric collection agent. Learn more at bosun.org. Buildin

Bosun 3.3k Jun 22, 2022
A Golang based high performance, scalable and distributed workflow framework

Go-Flow A Golang based high performance, scalable and distributed workflow framework It allows to programmatically author distributed workflow as Dire

Vanu 576 Jun 20, 2022
do-nothing scripting framework

donothing donothing is a Go framework for do-nothing scripting. Do-nothing scripting is an approach to writing procedures. It allows you to start with

Dan Slimmon 47 May 27, 2022
Kubernetes Native Serverless Framework

kubeless is a Kubernetes-native serverless framework that lets you deploy small bits of code without having to worry about the underlying infrastructu

Kubeless 6.8k Jun 19, 2022
Not another markup language. Framework for replacing Kubernetes YAML with Go.

Not another markup language. Replace Kubernetes YAML with raw Go! Say so long ?? to YAML and start using the Go ?? programming language to represent a

Kris Nóva 1.1k Jun 8, 2022
the simplest testing framework for Kubernetes controller.

KET(Kind E2e Test framework) KET is the simplest testing framework for Kubernetes controller. KET is available as open source software, and we look fo

Riita 36 May 12, 2022
Go framework to create Kubernetes mutating and validating webhooks

kubewebhook Kubewebhook is a small Go framework to create external admission webhooks for Kubernetes. With Kubewebhook you can make validating and mut

Xabier Larrakoetxea Gallego 456 Jun 15, 2022
Golang Integration Testing Framework For Kong Kubernetes APIs and Controllers.

Kong Kubernetes Testing Framework (KTF) Testing framework used by the Kong Kubernetes Team for the Kong Kubernetes Ingress Controller (KIC). Requireme

Kong 14 Jun 7, 2022
sail is an operation framework based on Ansible/Helm. sail follows the principles of Infrastructure as Code (IaC), Operation as Code (OaC), and Everything as Code. So it is a tool for DevOps.

sail 中文文档 sail is an operation framework based on Ansible/Helm. sail follows the principles of Infrastructure as Code (IaC), Operation as Code (OaC),a

Bougou Nisou 10 Dec 16, 2021
An Easy to use Go framework for Kubernetes based on kubernetes/client-go

k8devel An Easy to use Go framework for Kubernetes based on kubernetes/client-go, see examples dir for a quick start. How to test it ? Download the mo

null 10 Mar 25, 2022
Mesos Framework to use docker-compose files.

mesos-compose Mesos Framework to use docker-compose files. Requirements Apache Mesos min 1.6.0 Mesos with SSL and Authentication is optional Redis Dat

AVENTER UG (haftungsbeschränkt) 1 Apr 27, 2022
Kubernetes-native framework for test definition and execution

████████ ███████ ███████ ████████ ██ ██ ██ ██ ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████

kubeshop 326 Jun 18, 2022
Kratix is a framework for building Platform-as-a-Product

Kratix κρατήστε μια υπόσχεση | kratíste mia ypóschesi | Keep a promise Kratix is a framework for building Platform-as-a-Product. Kratix enables platfo

Syntasso 102 Jun 17, 2022
Boxygen is a container as code framework that allows you to build container images from code

Boxygen is a container as code framework that allows you to build container images from code, allowing integration of container image builds into other tooling such as servers or CLI tooling.

nitric 5 Dec 13, 2021
This is a sample application of golang's web framework gin and orm ent.

Gin Ent Sample This is a sample application of golang's web framework gin and orm ent. Components Web Framework: Gin ORM: ent SQL Migration tool: goos

Takumi Ikeda 0 Dec 5, 2021
Quick start repository for creating a Terraform provider using terraform-plugin-framework

Terraform Provider Scaffolding (Terraform Plugin Framework) This template repository is built on the Terraform Plugin Framework. The template reposito

HashiCorp 38 Jun 27, 2022
Cmsnr - cmsnr (pronounced "commissioner") is a lightweight framework for running OPA in a sidecar alongside your applications in Kubernetes.

cmsnr Description cmsnr (pronounced "commissioner") is a lightweight framework for running OPA in a sidecar alongside your applications in Kubernetes.

John Hooks 4 Jan 13, 2022
Errhandle - A golang error handling framework

errhandle A golang error handling framework About errhandle: An error handling f

Krisna Pranav 2 Jan 3, 2022
Shoes-agent - Framework for myshoes provider using agent

shoes-agent Framework for myshoes provider using agent. agent: agent for shoes-a

Tachibana waita 2 Jan 8, 2022