mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc: global id feature (#4293)
Feature to add annotations to ent schema to ensure sql tables have sequential auto-increment id columns. Meant to be a better alternative for entgql / gqlgen globally unique id feature.
This commit is contained in:
@@ -375,6 +375,21 @@ func OnDelete(opt ReferenceOption) *Annotation {
|
||||
}
|
||||
}
|
||||
|
||||
// IncrementStart specifies the starting value for auto-increment columns.
|
||||
//
|
||||
// For example, in order to define the starting value for auto-increment to be 100:
|
||||
//
|
||||
// func (T) Annotations() []schema.Annotation {
|
||||
// return []schema.Annotation{
|
||||
// entsql.IncrementStart(100),
|
||||
// }
|
||||
// }
|
||||
func IncrementStart(i int64) *Annotation {
|
||||
return &Annotation{
|
||||
IncrementStart: &i,
|
||||
}
|
||||
}
|
||||
|
||||
// Merge implements the schema.Merger interface.
|
||||
func (a Annotation) Merge(other schema.Annotation) schema.Annotation {
|
||||
var ant Annotation
|
||||
|
||||
Reference in New Issue
Block a user