mirror of
https://github.com/ent/ent.git
synced 2026-05-03 16:10:59 +03:00
entc/gen: merge list of entsql annotation to one (#928)
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/facebook/ent/dialect/entsql"
|
||||
"github.com/facebook/ent/dialect/sql"
|
||||
"github.com/facebook/ent/schema/field"
|
||||
)
|
||||
@@ -33,6 +34,7 @@ type Table struct {
|
||||
Indexes []*Index
|
||||
PrimaryKey []*Column
|
||||
ForeignKeys []*ForeignKey
|
||||
Annotation *entsql.Annotation
|
||||
}
|
||||
|
||||
// NewTable returns a new table with the given name.
|
||||
@@ -63,6 +65,12 @@ func (t *Table) AddColumn(c *Column) *Table {
|
||||
return t
|
||||
}
|
||||
|
||||
// SetAnnotation the entsql.Annotation on the table.
|
||||
func (t *Table) SetAnnotation(ant *entsql.Annotation) *Table {
|
||||
t.Annotation = ant
|
||||
return t
|
||||
}
|
||||
|
||||
// AddIndex creates and adds a new index to the table from the given options.
|
||||
func (t *Table) AddIndex(name string, unique bool, columns []string) *Table {
|
||||
return t.addIndex(&Index{
|
||||
|
||||
Reference in New Issue
Block a user