zkt24/z2/backend/ent/schema/blocks.go

31 lines
564 B
Go
Raw Normal View History

2024-04-25 11:51:47 +00:00
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Key holds the schema definition for the Key entity.
type Blocks struct {
ent.Schema
}
// Fields of the Key.
func (Blocks) Fields() []ent.Field {
return []ent.Field{
field.String("hash").Unique(),
field.Int("id").Unique(),
field.Int("length"),
field.String("previousHash").Unique(),
}
}
// Edges of the Key.
func (Blocks) Edges() []ent.Edge {
return []ent.Edge{
edge.To("Caster", Validators.Type),
edge.To("MinedTxs", Transactions.Type),
}
}