ent / ent/ent

Is it possible to modularize schema entities?

Open
#3,807 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
17.2k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

go run -mod=mod entgo.io/ent/cmd/ent new User

The command above will generate the schema for User under `./ent/schema/` directory:

I would like to put each entity to its own directory. I'm okay to have generated code stays under ./ent/ folder. My current folder layout as follows:

```
./moduleOne
- models.go
- handlers.go (graphql resolvers here)
- ...
./moduleTwo
- ...
```

I'm okay to have structure like below.

```
./moduleOne
- /ent
- User.go
- Role.go
- handlers.go
```

Contributor guide

Open the contributing guide

Research direction

Start with the `go run -mod=mod entgo.io/ent/cmd/ent new User` command and the current `./ent/schema/` layout. Determine whether schema files can be organized per module while generated code remains under `./ent/`; done means the requested layout is supported and generation succeeds for the example command.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.