initial
This commit is contained in:
29
ent/schema/logentry.go
Normal file
29
ent/schema/logentry.go
Normal file
@ -0,0 +1,29 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Logentry holds the schema definition for the Logentry entity.
|
||||
type Logentry struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the Logentry.
|
||||
func (Logentry) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id"),
|
||||
field.Time("date").Default(time.Now).Immutable(),
|
||||
field.Text("content"),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Logentry.
|
||||
func (Logentry) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("project", Project.Type).Ref("logentries").Unique(),
|
||||
}
|
||||
}
|
35
ent/schema/project.go
Normal file
35
ent/schema/project.go
Normal file
@ -0,0 +1,35 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Project holds the schema definition for the Project entity.
|
||||
type Project struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the Project.
|
||||
func (Project) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id"),
|
||||
field.Time("create_time").Default(time.Now).Immutable(),
|
||||
field.String("user"),
|
||||
field.String("group"),
|
||||
field.String("root_path"),
|
||||
field.String("service_name"),
|
||||
field.String("binary_path"),
|
||||
field.Bool("move_to_target").Default(false),
|
||||
field.String("binary_target_path").Optional(),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Project.
|
||||
func (Project) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.To("logentries", Logentry.Type),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user