31 lines
564 B
Go
31 lines
564 B
Go
|
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),
|
||
|
}
|
||
|
}
|