37 lines
658 B
Go
37 lines
658 B
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/field"
|
|
"entgo.io/ent/schema/index"
|
|
"time"
|
|
)
|
|
|
|
// Document holds the schema definition for the Document entity.
|
|
type Document struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the Document.
|
|
func (Document) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("name"),
|
|
field.String("user_id"),
|
|
field.Int64("library_id"),
|
|
|
|
field.Time("created_at").Default(time.Now),
|
|
field.Time("updated_at").Default(time.Now),
|
|
}
|
|
}
|
|
|
|
// Edges of the Document.
|
|
func (Document) Edges() []ent.Edge {
|
|
return nil
|
|
}
|
|
|
|
func (Document) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("name", "user_id"),
|
|
}
|
|
}
|