Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom window function selector #1

Closed
wants to merge 188 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
5800f6b
entc/gen: avoid setting the incremental attribute fo non-integer fiel…
a8m May 27, 2022
0917701
entc/gen: fix wrong UserDefined checks in templates (#2572)
giautm May 28, 2022
5b81d7d
dialect/sql/sqlgraph: better support for update nodes with predicates…
a8m May 29, 2022
c26d92d
entc/gen: support indexing edge schema with composite primary keys (#…
a8m May 30, 2022
6120ecf
Update README.md
a8m Jun 1, 2022
5d303d0
doc/privacy: add heading for filter rules section
a8m Jun 1, 2022
d071e0c
doc/md: fix some broken links (#2589)
hedwigz Jun 1, 2022
8fe8c74
doc/md: add more dialects to quickstart (#2588)
hedwigz Jun 1, 2022
6a166b9
ci: bump golangci-lint version (#2577)
sashamelentyev Jun 1, 2022
63592f7
go: bump atlas to latest master (#2584)
hedwigz Jun 1, 2022
2c3f65b
doc/website: do not refer to sqlite3 anymore (#2593)
frederikhors Jun 1, 2022
e634960
entc/gen: move a8m/entclean logic to ent (#2612)
a8m Jun 5, 2022
dd4519f
dialect/entsql: rename annotation vars (#2614)
sashamelentyev Jun 6, 2022
9e4660f
doc: change golang docs links for actual (#2620)
sashamelentyev Jun 6, 2022
d9d63b5
doc/md: use `fmt.Errorf` instead of `errors.Wrapf` (#2608)
frederikhors Jun 7, 2022
fd95565
entc/gen: change codegen signature from entc to ent (#2627)
a8m Jun 7, 2022
e615285
entc/gen: fix name clash in entc template when entity name has initia…
hax10 Jun 9, 2022
b2844fb
docs: add hax10 as a contributor for code (#2637)
allcontributors[bot] Jun 9, 2022
bfa9c96
dialect/sql/schema: introduce type store interface (#2636)
masseelch Jun 10, 2022
1572f1e
doc/md: fix NamedValues option in graphql tutorial (#2535)
dorlib Jun 12, 2022
cd1afb2
entc: improve generated comments for edges and fields (#2632)
willbicks Jun 13, 2022
195be2d
entc/gen: fixed unnamed field initialization (#2648)
giautm Jun 14, 2022
7017cbc
dialect/sql/schema: file based type store (#2644)
masseelch Jun 15, 2022
98d00a3
go: update atlas and test global-unique-id migration (#2661)
a8m Jun 18, 2022
b89b13b
doc/tutorial: fix typos (#2663)
smizuno2018 Jun 19, 2022
abefaa7
entc/gen: catch constraint failures in delete operations (#2664)
a8m Jun 19, 2022
311d760
entc/gen: allow opening and testing concurrent enttest clients (#2665)
a8m Jun 20, 2022
65ae273
build(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0 (#2667)
dependabot[bot] Jun 22, 2022
3bb5292
ci: remove unnecessary build flag from go test (#2672)
a8m Jun 22, 2022
b44d593
doc/website: oss footer logo (#2678)
a8m Jun 23, 2022
6ddeb93
entc/gen: use gotypw pkgname as alias in case it does not match pkgpa…
a8m Jun 25, 2022
49fc14f
examples/start: update group schema (#2687)
seawolf Jun 25, 2022
7cac3b2
entc/gen: support default id values for edge schemas (#2688)
a8m Jun 25, 2022
e8bf1d1
doc/md: fix up examples in getting-started (#2690)
nikitavoloboev Jun 26, 2022
84b05c0
doc/md: add info about using `WhereInput` as predicates (#2691)
frederikhors Jun 27, 2022
5dbfa24
doc/md: add docs on using expression predicates in custom WHERE claus…
gmhafiz Jun 29, 2022
6793d74
schema/field: support for sensitive json fields (#2701)
a8m Jun 29, 2022
8416fb5
dialect/sql/schema: setup tables before running migrate diff (#2703)
a8m Jun 30, 2022
4a26cab
improve multi-tenancy example and documentation (#2705)
a8m Jun 30, 2022
aec59a3
doc/md: update eager-loading implementation details (#2707)
a8m Jul 1, 2022
904b649
entc/gen: skip nodes with composite id types on default id-type detec…
a8m Jul 1, 2022
4f7b173
entc: cleanup defaults ID (#2709)
giautm Jul 1, 2022
ed783db
dialect/sql/sqlgraph: support edge-schema in upsert (#2714)
a8m Jul 3, 2022
91b6430
entc/gen: support setting GoType for integer IDs (#2657)
stoikheia Jul 4, 2022
5b67bda
dialect/sql/schema: atlas engine is now default (#2698)
masseelch Jul 5, 2022
8c55008
dialect/sql/sqlgraph: handle edge schema in batch inserts (#2718)
a8m Jul 5, 2022
2c1a355
entc/gen: ignore edge-fields order in edge-schema with composite iden…
a8m Jul 5, 2022
97a13df
build(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0 (#2724)
dependabot[bot] Jul 6, 2022
412f5f7
add docs about auto-increment counter "bug" in MySQL versions < 8.0 a…
masseelch Jul 6, 2022
ba582c8
entc/gen: improve edge-schema updates (#2726)
a8m Jul 7, 2022
52a1091
doc/md: type safe feature activation versioned migration (#2727)
masseelch Jul 7, 2022
0f33b0b
doc/md: update docs to fix #2731 (#2732)
masseelch Jul 8, 2022
bc623b3
all: update atlas (#2739)
masseelch Jul 11, 2022
b00e549
dialect/sql: make sql.In() with empty args fallback to False() (#2735)
Liooo Jul 11, 2022
6c8a130
entc/gen: edge schema with custom ids (#2742)
a8m Jul 12, 2022
3148324
entc/gen: support edgeschema with privacy (#2745)
a8m Jul 13, 2022
dd4a020
When run 'go generate ./ent', got error on [create type Todo: invalid…
nine-hundred Jul 13, 2022
1c01301
sql/dialect/schema: support setting PK to serial types in postgres (#…
a8m Jul 13, 2022
b5b5d87
entc/gen/integration: re-enable postgres tests (#2749)
a8m Jul 13, 2022
4491610
entc/gen/integration: add example for edge schema with privacy (#2743)
amrnt Jul 13, 2022
e601697
go: update ariga.io/atlas (#2751)
a8m Jul 13, 2022
5df06f4
go: update ariga.io/atlas (#2752)
a8m Jul 14, 2022
1c6ba55
go: update ariga.io/atlas (#2754)
a8m Jul 14, 2022
047b804
ent/gen: remove unnecessary if block in IN predicates (#2758)
a8m Jul 15, 2022
01f9733
entc/gen: use custom schema-type in join tables foreign-keys (#2760)
a8m Jul 15, 2022
ddc46d3
schema/field: correctly extract package names from type identifier (#…
a8m Jul 17, 2022
9e0d8af
ent/gen: use error.New for errors without format (#2764)
sashamelentyev Jul 17, 2022
0776704
entc/gen: skip enum identifier checks in case it has custom Go type (…
a8m Jul 17, 2022
9a04641
go: update ariga.io/atlas to latest master (#2767)
a8m Jul 17, 2022
42b68cb
doc/website: use title in code blocks (#2769)
a8m Jul 17, 2022
8beaef8
dialect/sql/builder: make sql.NotIn() with empty args fallback to NOT…
adayNU Jul 19, 2022
5daf02b
go: small refactoring for maps (#2619)
sashamelentyev Jul 19, 2022
88183c1
doc/website: document tweaking transaction isolation levels (#2774)
ItayGarin Jul 20, 2022
081f2bb
doc/website: update dialects doc to reflect postgres 14 testing (#2777)
thmeitz Jul 20, 2022
9bfe864
doc/predicates: fix invalid SQL example (#2778)
42atomys Jul 21, 2022
43ceed9
doc: update getting-started to not mention PATH
a8m Jul 23, 2022
a2b18f2
entc/gen: move eager-loading to method (#2790)
a8m Jul 23, 2022
b60e0f9
entc/gen: add support for WithNamed<E> feature-flag (#2792)
a8m Jul 24, 2022
31bc1a9
doc/website: update version-migration with global ids (#2798)
a8m Jul 25, 2022
d4aa8b6
doc/website: using go install instead of go get (#2796)
haoxins Jul 25, 2022
b9b502b
doc/schema-edges: fix annotation example (#2799)
a8m Jul 25, 2022
1ee2876
doc/website: add edit and lastedit info to doc pages (#2800)
a8m Jul 25, 2022
6f35622
entc/integration: exmaple for multischema in migration (#2804)
a8m Jul 27, 2022
f9dfac6
cmd/ent: add support for --template in init command (#2728)
dhuckins Jul 27, 2022
f5568d2
entc/gen: skip generating predicates that conflicts with FieldID cons…
a8m Jul 29, 2022
9673a4d
entc/gen: allow naming ent/schema as Field (#2811)
a8m Jul 29, 2022
3f04b0f
doc/md: update grpc tutorial for List and BatchCreate methods (#2518)
JeremyV2014 Jul 31, 2022
ea3aa8c
doc/md: remove entgql annotation from crud step (#2816)
gneyal Aug 1, 2022
26e07c9
dialect/sql/sqlgraph: support edgeschema in entgql (#2817)
a8m Aug 1, 2022
c7de2ec
doc/versioned-migration: add atlas import for code example (#2819)
a8m Aug 2, 2022
22c2f3a
build(deps): bump aws-actions/configure-aws-credentials (#2825)
dependabot[bot] Aug 3, 2022
89007ec
entc/gen: fixed privacy filter for M2M edges (#2828)
giautm Aug 3, 2022
4797277
go: bump go/packages version ci to 1.18+1.19 (#2832)
a8m Aug 5, 2022
9f481d8
dialect/sql: support setting ORDER BY for UPDATE statements
a8m Aug 5, 2022
0fd6413
dialect/sql/sqlgraph: support custom modifiers in UPDATE commands
a8m Aug 5, 2022
0066eb9
entc/gen: extend sql/modify to UPDATE statements
a8m Aug 5, 2022
24d1fad
examples: add ent init --template example
a8m Aug 11, 2022
7eb1ccd
entc/gen: ignore immutable fields updating during bulk upsert (#2840)
onobrod Aug 12, 2022
c8fc927
entc/gen: add tests for bulk-upsert fix in #2840 (#2845)
a8m Aug 12, 2022
b207429
entc/gen: allow setting required fields as nillable
a8m Aug 13, 2022
8fc8d65
doc/fields: add section for nillable-required fields
a8m Aug 13, 2022
0298893
.github/cd: update node version
a8m Aug 13, 2022
757fc94
doc/md: trigger master build
a8m Aug 13, 2022
5c2013b
entc/integration: example for #2846
a8m Aug 13, 2022
94b19ac
dialect/sql: use raw NULL value in statements rather than passing nil…
a8m Aug 14, 2022
01a4906
doc/migration: improve versioned migration workflow example (#2851)
a8m Aug 14, 2022
0350da3
doc/md: add missing codereview comment (#2852)
a8m Aug 14, 2022
5b3bcfa
go: update ariga.io/atlas (#2854)
a8m Aug 14, 2022
94226c9
doc: entci (#2853)
rotemtam Aug 14, 2022
6637cbf
examples/migration: add doc about migration linting (#2856)
a8m Aug 15, 2022
c53251c
doc/md/ci: fix weird sentence (#2858)
rotemtam Aug 15, 2022
cb01c28
doc/md/ci: fix yaml (#2859)
rotemtam Aug 15, 2022
bd1a311
build(deps): bump trim from 0.0.1 to 0.0.3 in /doc/website (#2848)
dependabot[bot] Aug 15, 2022
4d11fe3
build(deps): bump ansi-regex from 5.0.0 to 5.0.1 in /doc/website (#2855)
dependabot[bot] Aug 15, 2022
2b54aad
dialect/sql: escape EqualFold on Postgres (#2860)
crossworth Aug 16, 2022
50d4c62
doc/md: add instructions for migration dir linting in ci page (#2865)
rotemtam Aug 18, 2022
b02de28
doc/md: minor fixes to ci examples (#2867)
rotemtam Aug 19, 2022
67a2663
doc/md: a typo under the Mutation section (#2869)
yashdiniz Aug 19, 2022
a46edf3
all: update atlas (#2871)
masseelch Aug 19, 2022
b6c185a
dialect/sql/schema: make use of new atlas migration directories and r…
masseelch Aug 19, 2022
2c63d1d
all: gofmt -w -r 'interface{} -> any' (#2874)
a8m Aug 19, 2022
461ab4a
entc/gen: unexpose upsert setters for immutable fields (#2875)
a8m Aug 20, 2022
b18ca9c
schema/edge: allow setting immutable edges (#2876)
a8m Aug 20, 2022
f40cdf8
entc/gen: ensure immutability is consistent between edge and their fi…
a8m Aug 20, 2022
4467021
docs: add water-a as a contributor for bug (#2879)
allcontributors[bot] Aug 21, 2022
f3b6dd9
doc/md: add -mod=mod to 'go run' commands in documentation (#2881)
llimllib Aug 23, 2022
79fe0eb
sql/sqljson: add support for ValueIn/ValueNotIn (#2882)
a8m Aug 24, 2022
1cf4fc8
schema/field: ensure DefaultFunc argument is type func (#2884)
a8m Aug 28, 2022
bedbea6
dialct/sql/sqljson: fix HasKey implementation for SQLite (#2887)
a8m Aug 29, 2022
015effd
dialect/sql/builder: added FullJoin (#2885)
Liooo Aug 30, 2022
9200dcd
build(deps): bump minimist from 1.2.5 to 1.2.6 in /doc/website (#2872)
dependabot[bot] Aug 30, 2022
2615b3a
build(deps): bump github.com/mattn/go-sqlite3 from 1.14.14 to 1.14.15…
dependabot[bot] Aug 30, 2022
f797ac2
entc/gen: remove repeated template fragment (#2890)
weilence Aug 30, 2022
3b1b75b
dialect/sql/sqljson: remove duplicate word in comments (#2892)
Abirdcfly Aug 30, 2022
2969796
dialect/sql/sqlgraph: support batch-upadte for edge-schemas (#2897)
a8m Sep 2, 2022
b5976fb
go: update go version in go.mod (#2898)
Aagosh10 Sep 3, 2022
326fe42
entc/gen: use FirstID instead of Count for Exist calls (#2896)
Aagosh10 Sep 4, 2022
1e12537
entc/gen: support custom Acronym (#2900)
weilence Sep 6, 2022
1773fc4
dialect/sql: add support for statement prefix in update builder (#2904)
a8m Sep 6, 2022
2cdb627
dialect/sql/sqljson: quote non-identifiers (#2910)
giautm Sep 7, 2022
cfb0388
dialect/sql/entsql: support including non-key columns in postgres ind…
a8m Sep 7, 2022
dc44b9f
build(deps): bump github.com/lib/pq from 1.10.6 to 1.10.7 (#2909)
dependabot[bot] Sep 7, 2022
346af30
doc/website/blog: ci blogpost (#2903)
rotemtam Sep 8, 2022
d094310
doc/website/blog: fix ci link (#2913)
rotemtam Sep 8, 2022
82ee525
doc/tutorial: update entgql + gqlgen integration (#2915)
a8m Sep 8, 2022
29aa179
doc/md: update schema-indexes doc (#2914)
thuan1412 Sep 8, 2022
31e41da
doc: link from graphql doc to tutorial (#2917)
a8m Sep 8, 2022
d0bce8a
doc/graphql: link to tutorial basic setup (#2918)
a8m Sep 8, 2022
366aaaa
doc/md: change default execution engine to Atlas in documentation (#2…
masseelch Sep 8, 2022
ac937f8
entc/gen: allow using 'client' and 'tx' as schema field names (#2919)
a8m Sep 9, 2022
9e56543
doc/graphql: improve relay connection annotation (#2920)
a8m Sep 9, 2022
d9c71d7
schema/mixin: fix comments in godoc (#2921)
Aagosh10 Sep 10, 2022
d9b3004
doc/md: fix package name breaking generate (#2922)
broody Sep 11, 2022
4425d1a
cmd/ent: support 'ent describe' in edge-schemas (#2931)
a8m Sep 15, 2022
0adfb94
dialect/sql: support defining multiple FROM in query (#2933)
a8m Sep 15, 2022
b81db91
doc: minor fix Japanese README (#2935)
eltociear Sep 18, 2022
1f8e4ad
entc/gen: allow package with alias on ID field (#2926)
crossworth Sep 18, 2022
043fa71
Docs spelling arguement -> argument (#2939)
jhwz Sep 20, 2022
a3e38c5
docs: add jhwz as a contributor (#2943)
allcontributors[bot] Sep 20, 2022
3fc4ba6
dialect/entsql: add support for partial indexes (#2944)
a8m Sep 20, 2022
8502534
doc/indexes: add partial indexes example (#2945)
a8m Sep 20, 2022
f43b064
doc/md: add atlas migration import to versioned docs (#2942)
masseelch Sep 21, 2022
0f5cba6
doc: update schema-edges.mdx (#2947)
jiurenm Sep 22, 2022
139725e
dialect/sql/schema: no longer allocate a PK range for a join table (#…
masseelch Sep 23, 2022
baa282d
doc/tx: improve WithTx example (#2952)
a8m Sep 24, 2022
192eace
doc: make mutation and variable match todo.graphql (#2958)
kortschak Sep 26, 2022
16f9782
doc/md: fix broken links to "GraphQL example" (#2959)
yuki2006 Sep 26, 2022
7ad7df2
doc: make mutation and variable match todo.graphql (#2960)
kortschak Sep 26, 2022
679109f
entc/gen: remove space around `continue` for 1.18 compatible (#2962)
giautm Sep 26, 2022
e93e96e
dialect/sql/schema: use serial underlying types for fks (#2963)
a8m Sep 27, 2022
bd80e06
doc: fix file name for required change (#2961)
kortschak Sep 27, 2022
e02622a
docs: various fixes to the graphql tutorial (#2965)
kortschak Sep 27, 2022
c41d223
dialect/sql/schema: disable foreign keys before opening a transaction…
masseelch Sep 28, 2022
51d20e3
build(deps): bump path-parse from 1.0.6 to 1.0.7 in /doc/website (#2969)
dependabot[bot] Sep 28, 2022
b286a4b
build(deps): bump normalize-url from 4.5.0 to 4.5.1 in /doc/website (…
dependabot[bot] Sep 28, 2022
5330f87
doc/md: add ci instructions for SQLite (#2970)
masseelch Sep 28, 2022
eb4ea68
dialect/sql/sqljson: add dialect-aware Append function
a8m Sep 28, 2022
7ecc929
doc/features: add sqljson.Append to modifier examples
a8m Sep 29, 2022
fe743cc
doc: remove comment about edge-schema status (#2974)
a8m Sep 29, 2022
957d3c0
examples/entcpkg: code updated based on latest release (#2967)
surjit Sep 29, 2022
13bf27b
entc/gen: support Append<F> for JSON array fields (#2975)
a8m Sep 29, 2022
837d077
doc: add Append<F> to crud page (#2976)
a8m Sep 29, 2022
7d3d898
doc/md: various improvements to gRPC tutorial (#2977)
kortschak Sep 30, 2022
0b38ce8
add kortschak as a contributor for doc (#2978)
allcontributors[bot] Sep 30, 2022
1029a2d
entc/gen: attach tx hooks to underlying driver (#2980)
a8m Oct 1, 2022
0eaa78f
dialect/sql/sqljson: add option to evaluate json path inside a predic…
ronenlu Oct 2, 2022
35e950e
contributing: add sqljson to doc
a8m Oct 2, 2022
ec2571c
dialect/sql: add WindowSelector function to be able to customize sele…
timoha Oct 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 36 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,42 @@
"contributions": [
"code"
]
},
{
"login": "hax10",
"name": "hax10",
"avatar_url": "https://avatars.githubusercontent.com/u/85743468?v=4",
"profile": "https://github.com/hax10",
"contributions": [
"code"
]
},
{
"login": "water-a",
"name": "water-a",
"avatar_url": "https://avatars.githubusercontent.com/u/38114545?v=4",
"profile": "https://github.com/water-a",
"contributions": [
"bug"
]
},
{
"login": "jhwz",
"name": "jhwz",
"avatar_url": "https://avatars.githubusercontent.com/u/52683873?v=4",
"profile": "https://github.com/jhwz",
"contributions": [
"doc"
]
},
{
"login": "kortschak",
"name": "Dan Kortschak",
"avatar_url": "https://avatars.githubusercontent.com/u/275221?v=4",
"profile": "https://kortschak.io/",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16.14
- name: Install Dependencies
working-directory: doc/website
run: yarn
Expand All @@ -29,7 +31,7 @@ jobs:
working-directory: doc/website
run: yarn build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1.6.1
uses: aws-actions/configure-aws-credentials@v1.7.0
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.19
- name: Run linters
uses: golangci/golangci-lint-action@v3.1.0
uses: golangci/golangci-lint-action@v3.2.0
with:
version: v1.45.2
version: v1.48.0

unit:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.17', '1.18']
go: ['1.18', '1.19']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: '1.19'
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
Expand Down Expand Up @@ -411,7 +411,7 @@ jobs:
run: git checkout origin/master
- name: Run integration on origin/master
working-directory: entc/integration
run: go test -race -count=2 -tags=json1 ./...
run: go test -race -count=2 ./...
- name: Checkout previous HEAD
run: git checkout -
- name: Run integration on HEAD
Expand Down
10 changes: 7 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
go: '1.17'
timeout: 3m
go: '1.19'
timeout: 5m

linters-settings:
errcheck:
Expand All @@ -26,7 +26,7 @@ linters:
- errcheck
- funlen
- gocritic
- gofmt
# - gofmt; Enable back when upgrading CI to Go 1.20.
- goheader
- gosec
- gosimple
Expand Down Expand Up @@ -69,3 +69,7 @@ issues:
- path: entc/gen/graph.go
linters:
- gocritic
- path: \.go
linters:
- staticcheck
text: SA1019
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ possible.

- `dialect` - Contains SQL and Gremlin code used by the generated code.
- `dialect/sql/schema` - Auto migration logic resides there.
- `dialect/sql/sqljson` - JSON extension for SQL.

- `schema` - User schema API.
- `schema/{field, edge, index, mixin}` - provides schema builders API.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ 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, MariaDB, TiDB, PostgreSQL, SQLite and Gremlin.
- **Multi Storage Driver** - supports MySQL, MariaDB, TiDB, PostgreSQL, CockroachDB, SQLite and Gremlin.
- **Extendable** - simple to extend and customize using Go templates.

## Quick Installation
Expand Down
10 changes: 5 additions & 5 deletions README_jp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ src="https://s3.eu-central-1.amazonaws.com/entgo.io/assets/gopher_graph.png"/>
- **Schema As Code(コードとしてのスキーマ)** - あらゆるデータベーススキーマをGoオブジェクトとしてモデル化します。
- **任意のグラフを簡単にトラバースできます** - クエリや集約の実行、任意のグラフ構造の走査を容易に実行できます。
- **100%静的に型付けされた明示的なAPI** - コード生成により、100%静的に型付けされた曖昧さのないAPIを提供します。
- **マルチストレージドライバ** - MySQL、PostgreSQL、SQLite、Gremlinをサポートしています。
- **マルチストレージドライバ** - MySQL、MariaDB、 TiDB、PostgreSQL、CockroachDB、SQLite、Gremlinをサポートしています。
- **拡張性** - Goテンプレートを使用して簡単に拡張、カスタマイズできます。

## クイックインストール
```console
go install entgo.io/ent/cmd/ent@latest
```

[Go modules]を使ったインストールについては、[entgo.io website][entgo instal]をご覧ください。
[Go modules]を使ったインストールについては、[entgo.ioのWebサイト](https://entgo.io/ja/docs/code-gen/#entc-%E3%81%A8-ent-%E3%81%AE%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%82%92%E4%B8%80%E8%87%B4%E3%81%95%E3%81%9B%E3%82%8B)をご覧ください。

## ドキュメントとサポート
entを開発・使用するためのドキュメントは、こちら: https://entgo.io
entを開発・使用するためのドキュメントは、こちら: https://entgo.io

議論やサポートについては、[Issueを立てる](https://github.com/ent/ent/issues/new/choose)か、gophers Slackの[チャンネル](https://gophers.slack.com/archives/C01FMSQDT53)に参加してください。
議論やサポートについては、[Issueを開く](https://github.com/ent/ent/issues/new/choose)か、gophers Slackの[チャンネル](https://gophers.slack.com/archives/C01FMSQDT53)に参加してください。

## entコミュニティへの参加
`ent`の構築は、コミュニティ全体の協力なしには実現できませんでした。 私たちは、この`ent`の貢献者をリストアップした[contributorsページ](doc/md/contributors.md)を管理しています。
Expand All @@ -40,7 +40,7 @@ entを開発・使用するためのドキュメントは、こちら。: https:


## プロジェクトについて
`ent`プロジェクトは、私たちが社内で使用しているエンティティフレームワークである`Ent`からインスピレーションを得ています
`ent`プロジェクトは、私たちが社内で使用しているエンティティフレームワークであるEntからインスピレーションを得ています
entは、[Facebook Connectivity][fbc]チームの[a8m](https://github.com/a8m)と[alexsn](https://github.com/alexsn)が開発・保守しています。
本番環境では複数のチームやプロジェクトで使用されており、v1リリースまでのロードマップは[こちら](https://github.com/ent/ent/issues/46)に記載されています。
このプロジェクトの動機については[こちら](https://entgo.io/blog/2019/10/03/introducing-ent)をご覧ください。
Expand Down
38 changes: 25 additions & 13 deletions cmd/internal/base/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ func (IDType) String() string {

// InitCmd returns the init command for ent/c packages.
func InitCmd() *cobra.Command {
var target string
var target, tmplPath string
cmd := &cobra.Command{
Use: "init [flags] [schemas]",
Short: "initialize an environment with zero or more schemas",
Example: examples(
"ent init Example",
"ent init --target entv1/schema User Group",
"ent init --template ./path/to/file.tmpl User",
),
Args: func(_ *cobra.Command, names []string) error {
for _, name := range names {
Expand All @@ -81,12 +82,25 @@ func InitCmd() *cobra.Command {
return nil
},
Run: func(cmd *cobra.Command, names []string) {
if err := initEnv(target, names); err != nil {
var (
err error
tmpl *template.Template
)
if tmplPath != "" {
tmpl, err = template.ParseFiles(tmplPath)
} else {
tmpl, err = template.New("schema").Parse(defaultTemplate)
}
if err != nil {
log.Fatalln(fmt.Errorf("ent/init: could not parse template %w", err))
}
if err := initEnv(target, names, tmpl); err != nil {
log.Fatalln(fmt.Errorf("ent/init: %w", err))
}
},
}
cmd.Flags().StringVar(&target, "target", defaultSchema, "target directory for schemas")
cmd.Flags().StringVar(&tmplPath, "template", "", "template to use for new schemas")
return cmd
}

Expand Down Expand Up @@ -176,7 +190,7 @@ func GenerateCmd(postRun ...func(*gen.Config)) *cobra.Command {
}

// initEnv initialize an environment for ent codegen.
func initEnv(target string, names []string) error {
func initEnv(target string, names []string, tmpl *template.Template) error {
if err := createDir(target); err != nil {
return fmt.Errorf("create dir %s: %w", target, err)
}
Expand Down Expand Up @@ -222,9 +236,13 @@ func fileExists(target, name string) bool {
return err == nil
}

// schema template for the "init" command.
var tmpl = template.Must(template.New("schema").
Parse(`package schema
const (
// default schema package path.
defaultSchema = "ent/schema"
// ent/generate.go file used for "go generate" command.
genFile = "package ent\n\n//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate ./schema\n"
// schema template for the "init" command.
defaultTemplate = `package schema

import "entgo.io/ent"

Expand All @@ -242,13 +260,7 @@ func ({{ . }}) Fields() []ent.Field {
func ({{ . }}) Edges() []ent.Edge {
return nil
}
`))

const (
// default schema package path.
defaultSchema = "ent/schema"
// ent/generate.go file used for "go generate" command.
genFile = "package ent\n\n//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate ./schema\n"
`
)

// examples formats the given examples to the cli.
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/base/packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func testPkgPath(t *testing.T, x packagestest.Exporter) {
e := packagestest.Export(t, x, []packagestest.Module{
{
Name: "golang.org/x",
Files: map[string]interface{}{
Files: map[string]any{
"x.go": "package x",
"y/y.go": "package y",
},
Expand Down
7 changes: 5 additions & 2 deletions cmd/internal/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,20 @@ func Fprint(w io.Writer, g *gen.Graph) {
// <Fields Table>
//
// <Edges Table>
//
func (p Config) node(t *gen.Type) {
var (
b strings.Builder
id []*gen.Field
table = tablewriter.NewWriter(&b)
header = []string{"Field", "Type", "Unique", "Optional", "Nillable", "Default", "UpdateDefault", "Immutable", "StructTag", "Validators"}
)
b.WriteString(t.Name + ":\n")
table.SetAutoFormatHeaders(false)
table.SetHeader(header)
for _, f := range append([]*gen.Field{t.ID}, t.Fields...) {
if t.ID != nil {
id = append(id, t.ID)
}
for _, f := range append(id, t.Fields...) {
v := reflect.ValueOf(*f)
row := make([]string, len(header))
for i := range row {
Expand Down