33 lines
682 B
Go
33 lines
682 B
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/edge"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// Transactions holds the schema definition for the Transactions entity.
|
|
type Transactions struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the Transactions.
|
|
func (Transactions) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int("type"),
|
|
field.Int("timestamp"),
|
|
field.String("comment"),
|
|
field.Bytes("content"),
|
|
field.String("hash").Unique(),
|
|
field.String("signature").Unique(),
|
|
}
|
|
}
|
|
|
|
// Edges of the Transactions.
|
|
func (Transactions) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.From("Signer", Key.Type).Ref("Signed"),
|
|
edge.From("Block", Blocks.Type).Ref("MinedTxs"),
|
|
}
|
|
}
|