mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
schema/field: add annotation option to schema field (#622)
This commit is contained in:
@@ -239,6 +239,19 @@ func (b *intBuilder) GoType(typ interface{}) *intBuilder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Int("int").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *intBuilder) Annotations(annotations ...Annotation) *intBuilder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *intBuilder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -366,6 +379,19 @@ func (b *uintBuilder) GoType(typ interface{}) *uintBuilder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Uint("uint").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *uintBuilder) Annotations(annotations ...Annotation) *uintBuilder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *uintBuilder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -503,6 +529,19 @@ func (b *int8Builder) GoType(typ interface{}) *int8Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Int8("int8").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *int8Builder) Annotations(annotations ...Annotation) *int8Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *int8Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -640,6 +679,19 @@ func (b *int16Builder) GoType(typ interface{}) *int16Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Int16("int16").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *int16Builder) Annotations(annotations ...Annotation) *int16Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *int16Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -777,6 +829,19 @@ func (b *int32Builder) GoType(typ interface{}) *int32Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Int32("int32").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *int32Builder) Annotations(annotations ...Annotation) *int32Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *int32Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -914,6 +979,19 @@ func (b *int64Builder) GoType(typ interface{}) *int64Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Int64("int64").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *int64Builder) Annotations(annotations ...Annotation) *int64Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *int64Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -1041,6 +1119,19 @@ func (b *uint8Builder) GoType(typ interface{}) *uint8Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Uint8("uint8").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *uint8Builder) Annotations(annotations ...Annotation) *uint8Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *uint8Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -1168,6 +1259,19 @@ func (b *uint16Builder) GoType(typ interface{}) *uint16Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Uint16("uint16").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *uint16Builder) Annotations(annotations ...Annotation) *uint16Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *uint16Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -1295,6 +1399,19 @@ func (b *uint32Builder) GoType(typ interface{}) *uint32Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Uint32("uint32").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *uint32Builder) Annotations(annotations ...Annotation) *uint32Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *uint32Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -1422,6 +1539,19 @@ func (b *uint64Builder) GoType(typ interface{}) *uint64Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Uint64("uint64").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *uint64Builder) Annotations(annotations ...Annotation) *uint64Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *uint64Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -1568,6 +1698,19 @@ func (b *float64Builder) GoType(typ interface{}) *float64Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Float64("float64").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *float64Builder) Annotations(annotations ...Annotation) *float64Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *float64Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
@@ -1701,6 +1844,19 @@ func (b *float32Builder) GoType(typ interface{}) *float32Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// Annotations adds a list of annotations to the field object to be used by
|
||||
// codegen extensions.
|
||||
//
|
||||
// field.Float32("float32").
|
||||
// Annotations(entgql.Config{
|
||||
// Ordered: true,
|
||||
// })
|
||||
//
|
||||
func (b *float32Builder) Annotations(annotations ...Annotation) *float32Builder {
|
||||
b.desc.Annotations = append(b.desc.Annotations, annotations...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Descriptor implements the ent.Field interface by returning its descriptor.
|
||||
func (b *float32Builder) Descriptor() *Descriptor {
|
||||
return b.desc
|
||||
|
||||
Reference in New Issue
Block a user