Move pagination_query.tmpl and time_mixin.go to starter

This commit is contained in:
Achim Rohn
2025-11-15 14:10:00 +01:00
parent 8f50cc9c29
commit 7a3e1ffcfc
6 changed files with 85 additions and 11 deletions
+27
View File
@@ -0,0 +1,27 @@
package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/mixin"
)
// TimeMixin implements the ent.Mixin for sharing
// time fields with package schemas.
type TimeMixin struct {
mixin.Schema
}
// Fields of the TimeMixin.
func (TimeMixin) Fields() []ent.Field {
return []ent.Field{
field.Time("created_at").
Default(time.Now).
Immutable(),
field.Time("updated_at").
Default(time.Now).
UpdateDefault(time.Now),
}
}