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

29 lines
517 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 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),
}
}