Первый прототип с основными возможностями
This commit is contained in:
33
ent/schema/user.go
Normal file
33
ent/schema/user.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// User holds the schema definition for the User entity.
|
||||
type User struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the User.
|
||||
func (User) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.UUID("id", uuid.UUID{}).
|
||||
Default(uuid.New).
|
||||
Unique().
|
||||
Immutable(),
|
||||
field.Int64("telegram_id").
|
||||
Immutable().
|
||||
Unique(),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the User.
|
||||
func (User) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.To("links", Link.Type),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user