38 lines
696 B
Go
38 lines
696 B
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/field"
|
|
"entgo.io/ent/schema/index"
|
|
"time"
|
|
)
|
|
|
|
// Library holds the schema definition for the Library entity.
|
|
type Library struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the Library.
|
|
func (Library) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("name"),
|
|
field.Uint64("user_id"),
|
|
field.Time("created_at").Default(time.Now),
|
|
field.Time("updated_at").Default(time.Now),
|
|
}
|
|
}
|
|
|
|
// Edges of the Library.
|
|
func (Library) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
//edge.To("library", Library.Type),
|
|
}
|
|
}
|
|
|
|
// Indexes of the Library.
|
|
func (Library) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("name", "user_id"),
|
|
}
|
|
}
|