155 Commits

Author SHA1 Message Date
liangminhua
86238d83fc schema/field: add rune length validators for string fields (#4398)
Signed-off-by: liangminhua <ben302010@live.cn>
2025-06-20 13:42:13 +07:00
Tantatorn Suksangwarn
eb09059141 schema/field: add DefaultFunc and UpdateDefault to float types (#4256)
* feat: add `DefaultFunc` to float type

* feat: add `UpdateDefault` to float type

* test: update `TestMarshalDefaults` in `schema_test.go`
2024-11-30 00:26:01 +02:00
Ariel Mashraki
009b396d7e schema/field: allow setting time fields as unique (#4220)
* schema/field: allow setting time fields as unique

* .github: goodbye crate-ci/typos
2024-09-19 21:59:59 +03:00
Ariel Mashraki
7871b82e81 schema/field: support annotating fields as deprecated (#4132) 2024-07-10 15:55:37 +03:00
Jannik Clausen
092b62a322 schema/field: add support for ValueScanner on field.Bytes() (#4067) 2024-05-21 08:58:50 +02:00
Jannik Clausen
9f917c7263 schema/fields: validate for slices builder (#3566)
This PR changes the way slice types are built and adds the possibility to add a custom validation function to json slice types.
2023-05-30 10:02:27 +02:00
Ariel Mashraki
3f1063c77e schema/field: add support or external ValueScanner (#3391) 2023-03-16 22:18:54 +02:00
Ariel Mashraki
81eb431081 schema/field: allow using JSON fields with type 'any' (#3380)
Fixed https://github.com/ent/ent/issues/3104
2023-03-10 10:20:51 +02:00
Ariel Mashraki
3b7715b552 dialect/sql/schema: allow setting table comments (#3365) 2023-03-04 20:50:26 +02:00
Ariel Mashraki
9517200cb6 schema/field: fallback to native validator if not configured one (#3359) 2023-03-01 12:09:26 +02:00
Ariel Mashraki
f226627d67 ent: export query interceptors (#3157) 2022-12-19 10:17:10 +02:00
Andy Day
63c123f36c schema: add Comment annotation (#3164)
* Add schema.CommentAnnotation (resolves #3155)

Adds new mechanism for customizing a model's godoc comment in code (via an Annotation).

* feedback
2022-12-10 23:30:45 +02:00
Ariel Mashraki
3f1d7c960e example: add jsonencode using extension (#3142) 2022-12-04 10:38:23 +02:00
Aagosh
d9c71d7f67 schema/mixin: fix comments in godoc (#2921) 2022-09-10 13:41:26 +03:00
Ariel Mashraki
1cf4fc88c7 schema/field: ensure DefaultFunc argument is type func (#2884) 2022-08-28 20:56:10 +03:00
Ariel Mashraki
b18ca9ca6f schema/edge: allow setting immutable edges (#2876) 2022-08-20 19:10:16 +03:00
Ariel Mashraki
2c63d1d70e all: gofmt -w -r 'interface{} -> any' (#2874) 2022-08-19 18:23:04 +03:00
Ariel Mashraki
47972774c5 go: bump go/packages version ci to 1.18+1.19 (#2832)
* bumped pkg golang.org/x/tools version to address issue #2826

* .github: update go1.19 in go generate

Co-authored-by: Ankit Patial <ankitpatial@gmail.com>
2022-08-05 11:17:53 +03:00
Sasha Melentyev
5daf02bc73 go: small refactoring for maps (#2619) 2022-07-19 18:07:55 +03:00
Ariel Mashraki
ddc46d34d8 schema/field: correctly extract package names from type identifier (#2765)
Fixes https://github.com/ent/ent/issues/2761
2022-07-17 16:49:11 +03:00
Ariel Mashraki
6793d74da7 schema/field: support for sensitive json fields (#2701)
Closed https://github.com/ent/ent/issues/2596
2022-06-29 11:27:10 +03:00
Will Bicks
cd1afb235c entc: improve generated comments for edges and fields (#2632)
* replace default field comment with user comment if defined
* use comments defined on edges in generated entities
* add docs for comment method on edges and fields
* update integration to reflect above changes
2022-06-13 15:52:47 +03:00
Ariel Mashraki
e1c5277483 ent: initial support for edge schemas (#2560) 2022-05-25 15:46:00 +03:00
Ariel Mashraki
879bb8a905 entc/integration/json: add example for using interfaces in JSON fields (#2497) 2022-04-25 13:34:05 +03:00
Frédéric G. MARAND
110d0d138a ent/schema/field: fix incorrect Go code in GoType() doc comments (#2441)
All examples used repeated argument names, which do not compile
2022-04-01 19:35:23 +03:00
Ariel Mashraki
78a0fd9716 schema/field: expose RType.Implements method (#2379)
Also, add both (T) and (*T) methods for RType
2022-03-07 22:33:50 +02:00
유용환
8e9e6343f4 schema/edge: fix grammar in godoc (#2313) 2022-02-06 12:37:02 +02:00
Zhizhen He
9da36e461f all: fix typos (#2301) 2022-01-29 10:30:31 +02:00
Ariel Mashraki
f8c0f02803 schema/field: add support for type-aware Default and UpdateDefault in time fields (#2289) 2022-01-24 14:27:57 +02:00
Clarence
eca70b8490 schema/field: array types are nillable (#2266)
* all: type fixes

* schema/field: remove array check from goType
2022-01-13 13:39:11 +02:00
Alexander Melentyev
147b1f59ae all: small typo fixes (#2095) 2021-11-01 17:47:06 +02:00
Ariel Mashraki
82eeeb5a1c entc/gen: introduce the entc.Dependency option 2021-10-26 20:33:04 +03:00
Ariel Mashraki
e687246f7a schema/field: support default values for json and other 2021-10-21 22:57:04 +03:00
Ariel Mashraki
9e809635b2 entc/gen: ignore immutable fields on Upsert<T>.UpdateNewValues
Also, for some reason, the TimeMixin.UpdateTime was an immutable field,
but this was incorrent, because the codegen just skip generating
update setters to it. Removing the Immutable modifier allows users
to set this field explicitly.
2021-10-08 08:20:05 +03:00
Evan Lurvey
300f0b5307 schema/field: add the Sensitive option to field.Bytes (#1982)
* Add Sensitive() option to bytesBuilder

I have a use case where I want to store bytes but I want to use the sensitive option.

* Added new field test and ran generation

Co-authored-by: Evan Lurvey <elurvey@Evans-Mac-mini.local>
2021-09-25 23:21:55 +03:00
Ariel Mashraki
ee606f4e86 schema/field: add codegen header for template 2021-08-26 21:33:56 +03:00
Mohammed Salman
51ddb405fb schema/field: fix annotations doc example (#1878)
* schema/field: Fix annotation doc example

* Update numeric.tpl
2021-08-26 20:31:11 +03:00
Amit Shani
60e726812b schema/field: add NotEmpty built-in validator to bytes fields (#1869)
* added MaxLen built-in validator to `[]byte`

* typo

* move test to type_test.go

* Update doc/md/schema-fields.md

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* added min len validator to bytes

* fix tests
go generate

* CR

* add not empty validator

* CR

* doc/md:  add doc on `NotEmpty` bytes validator

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2021-08-24 14:47:15 +03:00
Amit Shani
ac0bd65145 schema/field: add MinLen built-in validator to bytes fields (#1867)
* added MaxLen built-in validator to `[]byte`

* typo

* move test to type_test.go

* Update doc/md/schema-fields.md

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* added min len validator to bytes

* fix tests
go generate

* CR

* CR

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2021-08-24 14:07:29 +03:00
Amit Shani
ad792fe79e schema/field: add MaxLen built-in validator to bytes fields (#1863)
* added MaxLen built-in validator to `[]byte`

* typo

* move test to type_test.go

* Update doc/md/schema-fields.md

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2021-08-24 10:23:43 +03:00
Ariel Mashraki
11843ff867 go: upgrade to 1.17 2021-08-21 00:14:22 +03:00
Mohammed Salman
710d5d77e9 schema/index: update index comments (#1814)
* update index comments

* Update schema/index/index.go

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2021-08-08 12:55:04 +03:00
Ariel Mashraki
8973af9b40 schema/field: add support for setting update default funcs to numeric fields (#1770)
* schema/field:add UpdateDefault to numeric (#1718)

* schema/field:fix comment

* schema/field: change interface to self type with DefaultFunc/UpdateDefault

* schema/field: change interface to self type with DefaultFunc/UpdateDefault

* schema/field: change interface to self type with DefaultFunc/UpdateDefault

* schema/field: add support for setting update default funcs to numeric fields

Co-authored-by: godcong <jumbycc@163.com>
2021-07-26 13:17:16 +03:00
Tarrence van As
cdfa3e35bb entc/gen: add Exec and ExecX to Create builder (#1753) 2021-07-23 15:00:47 +03:00
Tarrence van As
dfc7a79f6d schema/field: support unique bytes (#1720) 2021-07-20 10:24:38 +03:00
Ariel Mashraki
4eefbb6af9 schema/field: support validator for Bytes fields
Fixed #1714
2021-07-13 21:42:50 +03:00
Ariel Mashraki
c40ae45aee entc/gen: add support for summing custom Go numeric types 2021-06-25 17:30:17 +03:00
Ariel Mashraki
46cf7ad36a schema/field: store reflect type info in json fields 2021-05-31 10:04:50 +03:00
Ariel Mashraki
af73543265 schema/field: change NamedValues documentation (#1591) 2021-05-23 12:12:00 +03:00
Andy Day
237799dd2e schema/field: allow non-string ValueScanner types for enum fields (#1577)
* Make non-string ValueScanner types work with enum fields

This change fixes #1575 which now makes it possible to specify a GoType
for an enum that is not a string alias. It requires that if the specified
type is not a string alias, the type must satisfy the Stringer interface.

* remove default, rename field

* wip

* remove comment

* go generate

* make optional

* generate 🤦

* handle NULL case

* turns out mysql stores strings as []uint8
2021-05-20 23:29:47 +03:00