schema/field: allow setting time fields as unique (#4220)

* schema/field: allow setting time fields as unique

* .github: goodbye crate-ci/typos
This commit is contained in:
Ariel Mashraki
2024-09-19 21:59:59 +03:00
committed by GitHub
parent a733167c6f
commit 009b396d7e
19 changed files with 590 additions and 61 deletions

View File

@@ -477,6 +477,12 @@ func (b *timeBuilder) Deprecated(reason ...string) *timeBuilder {
return b
}
// Unique makes the field unique within all vertices of this type.
func (b *timeBuilder) Unique() *timeBuilder {
b.desc.Unique = true
return b
}
// Descriptor implements the ent.Field interface by returning its descriptor.
func (b *timeBuilder) Descriptor() *Descriptor {
if b.desc.Default != nil {