mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
all: update atlasgo.io to latest (#2376)
This commit is contained in:
@@ -16,9 +16,9 @@ const (
|
||||
// UserFieldID holds the string denoting the ID field of the User.
|
||||
UserFieldID = "oid"
|
||||
// Table holds the table name of the car in the database.
|
||||
Table = "cars"
|
||||
Table = "Car"
|
||||
// OwnerTable is the table that holds the owner relation/edge.
|
||||
OwnerTable = "cars"
|
||||
OwnerTable = "Car"
|
||||
// OwnerInverseTable is the table name for the User entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "user" package.
|
||||
OwnerInverseTable = "users"
|
||||
@@ -31,7 +31,7 @@ var Columns = []string{
|
||||
FieldID,
|
||||
}
|
||||
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "cars"
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "Car"
|
||||
// table and are not defined as standalone fields in the schema.
|
||||
var ForeignKeys = []string{
|
||||
"user_car",
|
||||
|
||||
@@ -13,20 +13,20 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// CarsColumns holds the columns for the "cars" table.
|
||||
CarsColumns = []*schema.Column{
|
||||
// CarColumns holds the columns for the "Car" table.
|
||||
CarColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "user_car", Type: field.TypeInt, Unique: true, Nullable: true},
|
||||
}
|
||||
// CarsTable holds the schema information for the "cars" table.
|
||||
CarsTable = &schema.Table{
|
||||
Name: "cars",
|
||||
Columns: CarsColumns,
|
||||
PrimaryKey: []*schema.Column{CarsColumns[0]},
|
||||
// CarTable holds the schema information for the "Car" table.
|
||||
CarTable = &schema.Table{
|
||||
Name: "Car",
|
||||
Columns: CarColumns,
|
||||
PrimaryKey: []*schema.Column{CarColumns[0]},
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "cars_users_car",
|
||||
Columns: []*schema.Column{CarsColumns[1]},
|
||||
Symbol: "Car_users_car",
|
||||
Columns: []*schema.Column{CarColumns[1]},
|
||||
RefColumns: []*schema.Column{UsersColumns[0]},
|
||||
OnDelete: schema.SetNull,
|
||||
},
|
||||
@@ -115,7 +115,7 @@ var (
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
CarsTable,
|
||||
CarTable,
|
||||
ConversionsTable,
|
||||
CustomTypesTable,
|
||||
UsersTable,
|
||||
@@ -123,7 +123,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
CarsTable.ForeignKeys[0].RefTable = UsersTable
|
||||
CarTable.ForeignKeys[0].RefTable = UsersTable
|
||||
CarTable.Annotation = &entsql.Annotation{
|
||||
Table: "Car",
|
||||
}
|
||||
UsersTable.ForeignKeys[0].RefTable = UsersTable
|
||||
UsersTable.ForeignKeys[1].RefTable = UsersTable
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package schema
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
@@ -72,6 +73,13 @@ type Car struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Annotations of the Car.
|
||||
func (Car) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{Table: "Car"},
|
||||
}
|
||||
}
|
||||
|
||||
func (Car) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("owner", User.Type).
|
||||
|
||||
@@ -60,10 +60,10 @@ const (
|
||||
// SpouseColumn is the table column denoting the spouse relation/edge.
|
||||
SpouseColumn = "user_spouse"
|
||||
// CarTable is the table that holds the car relation/edge.
|
||||
CarTable = "cars"
|
||||
CarTable = "Car"
|
||||
// CarInverseTable is the table name for the Car entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "car" package.
|
||||
CarInverseTable = "cars"
|
||||
CarInverseTable = "Car"
|
||||
// CarColumn is the table column denoting the car relation/edge.
|
||||
CarColumn = "user_car"
|
||||
)
|
||||
|
||||
@@ -16,9 +16,9 @@ const (
|
||||
// UserFieldID holds the string denoting the ID field of the User.
|
||||
UserFieldID = "oid"
|
||||
// Table holds the table name of the car in the database.
|
||||
Table = "cars"
|
||||
Table = "Car"
|
||||
// OwnerTable is the table that holds the owner relation/edge.
|
||||
OwnerTable = "cars"
|
||||
OwnerTable = "Car"
|
||||
// OwnerInverseTable is the table name for the User entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "user" package.
|
||||
OwnerInverseTable = "users"
|
||||
@@ -31,7 +31,7 @@ var Columns = []string{
|
||||
FieldID,
|
||||
}
|
||||
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "cars"
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "Car"
|
||||
// table and are not defined as standalone fields in the schema.
|
||||
var ForeignKeys = []string{
|
||||
"user_car",
|
||||
|
||||
@@ -13,20 +13,20 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// CarsColumns holds the columns for the "cars" table.
|
||||
CarsColumns = []*schema.Column{
|
||||
// CarColumns holds the columns for the "Car" table.
|
||||
CarColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "user_car", Type: field.TypeInt},
|
||||
}
|
||||
// CarsTable holds the schema information for the "cars" table.
|
||||
CarsTable = &schema.Table{
|
||||
Name: "cars",
|
||||
Columns: CarsColumns,
|
||||
PrimaryKey: []*schema.Column{CarsColumns[0]},
|
||||
// CarTable holds the schema information for the "Car" table.
|
||||
CarTable = &schema.Table{
|
||||
Name: "Car",
|
||||
Columns: CarColumns,
|
||||
PrimaryKey: []*schema.Column{CarColumns[0]},
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "cars_users_car",
|
||||
Columns: []*schema.Column{CarsColumns[1]},
|
||||
Symbol: "Car_users_car",
|
||||
Columns: []*schema.Column{CarColumns[1]},
|
||||
RefColumns: []*schema.Column{UsersColumns[0]},
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
@@ -209,7 +209,7 @@ var (
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
CarsTable,
|
||||
CarTable,
|
||||
ConversionsTable,
|
||||
CustomTypesTable,
|
||||
GroupsTable,
|
||||
@@ -221,7 +221,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
CarsTable.ForeignKeys[0].RefTable = UsersTable
|
||||
CarTable.ForeignKeys[0].RefTable = UsersTable
|
||||
CarTable.Annotation = &entsql.Annotation{
|
||||
Table: "Car",
|
||||
}
|
||||
MediaTable.Annotation = &entsql.Annotation{
|
||||
Check: "text <> 'boring'",
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ package schema
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/schema"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
@@ -142,6 +144,13 @@ type Car struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Annotations of the Car.
|
||||
func (Car) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{Table: "Car"},
|
||||
}
|
||||
}
|
||||
|
||||
func (Car) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("owner", User.Type).
|
||||
|
||||
@@ -59,10 +59,10 @@ const (
|
||||
// Table holds the table name of the user in the database.
|
||||
Table = "users"
|
||||
// CarTable is the table that holds the car relation/edge.
|
||||
CarTable = "cars"
|
||||
CarTable = "Car"
|
||||
// CarInverseTable is the table name for the Car entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "car" package.
|
||||
CarInverseTable = "cars"
|
||||
CarInverseTable = "Car"
|
||||
// CarColumn is the table column denoting the car relation/edge.
|
||||
CarColumn = "user_car"
|
||||
// PetsTable is the table that holds the pets relation/edge.
|
||||
|
||||
Reference in New Issue
Block a user