29 lines
517 B
Go
29 lines
517 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 Key struct {
|
||
|
ent.Schema
|
||
|
}
|
||
|
|
||
|
// Fields of the Key.
|
||
|
func (Key) Fields() []ent.Field {
|
||
|
return []ent.Field{
|
||
|
field.String("publicKey").NotEmpty().Unique(),
|
||
|
field.String("Owner").NotEmpty(),
|
||
|
field.Float("trustScore").Default(0.2),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Edges of the Key.
|
||
|
func (Key) Edges() []ent.Edge {
|
||
|
return []ent.Edge{
|
||
|
edge.To("Signed", Transactions.Type),
|
||
|
}
|
||
|
}
|