bitbucket.org/Aishee/synsec@v0.0.0-20210414005726-236fc01a153d/pkg/database/ent/schema/decision.go (about)

     1  package schema
     2  
     3  import (
     4  	"time"
     5  
     6  	"entgo.io/ent"
     7  	"entgo.io/ent/schema/edge"
     8  	"entgo.io/ent/schema/field"
     9  )
    10  
    11  // Decision holds the schema definition for the Decision entity.
    12  type Decision struct {
    13  	ent.Schema
    14  }
    15  
    16  // Fields of the Decision.
    17  func (Decision) Fields() []ent.Field {
    18  	return []ent.Field{
    19  		field.Time("created_at").
    20  			Default(time.Now),
    21  		field.Time("updated_at").
    22  			Default(time.Now),
    23  		field.Time("until"),
    24  		field.String("scenario"),
    25  		field.String("type"),
    26  		field.Int64("start_ip").Optional(),
    27  		field.Int64("end_ip").Optional(),
    28  		field.Int64("start_suffix").Optional(),
    29  		field.Int64("end_suffix").Optional(),
    30  		field.Int64("ip_size").Optional(),
    31  		field.String("scope"),
    32  		field.String("value"),
    33  		field.String("origin"),
    34  		field.Bool("simulated").Default(false),
    35  	}
    36  }
    37  
    38  // Edges of the Decision.
    39  func (Decision) Edges() []ent.Edge {
    40  	return []ent.Edge{
    41  		edge.From("owner", Alert.Type).
    42  			Ref("decisions").
    43  			Unique(),
    44  	}
    45  }