package schema import ( "time" "entgo.io/ent" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/google/uuid" ) // KVEntry holds the schema definition for the KVEntry entity. type KVEntry struct { ent.Schema } func (KVEntry) Indexes() []ent.Index { return []ent.Index{ index.Fields("key"). Unique(), } } // Fields of the KVEntry. func (KVEntry) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}). Default(uuid.New), field.Bytes("key"). Unique(). Immutable(). MaxLen(32). NotEmpty(), field.Time("modified_at"). Default(time.Now), field.Time("ttl"). Optional(). Nillable(), field.Bytes("state"), } } // Edges of the KVEntry. func (KVEntry) Edges() []ent.Edge { return nil }