2023-03-05 07:00:28 +00:00
|
|
|
package schema
|
|
|
|
|
|
|
|
import (
|
|
|
|
"entgo.io/ent"
|
|
|
|
|
|
|
|
"github.com/hay-kot/homebox/backend/internal/data/ent/schema/mixins"
|
|
|
|
)
|
|
|
|
|
|
|
|
type {{ .Scaffold.model }} struct {
|
|
|
|
ent.Schema
|
|
|
|
}
|
|
|
|
|
|
|
|
func ({{ .Scaffold.model }}) Mixin() []ent.Mixin {
|
|
|
|
return []ent.Mixin{
|
|
|
|
mixins.BaseMixin{},
|
2023-03-06 06:56:53 +00:00
|
|
|
{{- if .Scaffold.by_group }}
|
|
|
|
GroupMixin{ref: "{{ snakecase .Scaffold.model }}s"},
|
|
|
|
{{- end }}
|
2023-03-05 07:00:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fields of the {{ .Scaffold.model }}.
|
|
|
|
func ({{ .Scaffold.model }}) Fields() []ent.Field {
|
|
|
|
return []ent.Field{
|
|
|
|
// field.String("name").
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Edges of the {{ .Scaffold.model }}.
|
|
|
|
func ({{ .Scaffold.model }}) Edges() []ent.Edge {
|
|
|
|
return []ent.Edge{
|
|
|
|
// edge.From("group", Group.Type).
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func ({{ .Scaffold.model }}) Indexes() []ent.Index {
|
|
|
|
return []ent.Index{
|
|
|
|
// index.Fields("token"),
|
|
|
|
}
|
|
|
|
}
|