37 lines
637 B
Go
37 lines
637 B
Go
|
package schema
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"entgo.io/contrib/entgql"
|
||
|
"entgo.io/ent/schema/field"
|
||
|
)
|
||
|
|
||
|
var fieldID = field.Int64("id").
|
||
|
Immutable().
|
||
|
Unique()
|
||
|
|
||
|
var fieldCreated = field.Time("created_at").
|
||
|
Immutable().
|
||
|
Default(time.Now).
|
||
|
StructTag(`json:"createdAt"`).
|
||
|
Annotations(
|
||
|
entgql.OrderField("created"),
|
||
|
)
|
||
|
|
||
|
var fieldUpdated = field.Time("updated_at").
|
||
|
Default(time.Now).
|
||
|
UpdateDefault(time.Now).
|
||
|
StructTag(`json:"updatedAt"`).
|
||
|
Annotations(
|
||
|
entgql.OrderField("updated"),
|
||
|
)
|
||
|
|
||
|
var fieldDeleted = field.Time("deleted_at").
|
||
|
Optional().
|
||
|
Nillable().
|
||
|
StructTag(`json:"deletedAt"`).
|
||
|
Annotations(
|
||
|
entgql.OrderField("deleted"),
|
||
|
)
|