github.com/crowdsecurity/crowdsec@v1.6.1/pkg/database/ent/schema/config.go (about)

     1  package schema
     2  
     3  import (
     4  	"entgo.io/ent"
     5  	"entgo.io/ent/schema/field"
     6  	"github.com/crowdsecurity/crowdsec/pkg/types"
     7  )
     8  
     9  // ConfigItem holds the schema definition for the ConfigItem entity.
    10  type ConfigItem struct {
    11  	ent.Schema
    12  }
    13  
    14  // Fields of the Bouncer.
    15  func (ConfigItem) Fields() []ent.Field {
    16  	return []ent.Field{
    17  		field.Time("created_at").
    18  			Default(types.UtcNow).
    19  			UpdateDefault(types.UtcNow).Nillable().Optional().StructTag(`json:"created_at"`),
    20  		field.Time("updated_at").
    21  			Default(types.UtcNow).
    22  			UpdateDefault(types.UtcNow).Nillable().Optional().StructTag(`json:"updated_at"`),
    23  		field.String("name").Unique().StructTag(`json:"name"`),
    24  		field.String("value").StructTag(`json:"value"`), // a json object
    25  	}
    26  }
    27  
    28  // Edges of the Bouncer.
    29  func (ConfigItem) Edges() []ent.Edge {
    30  	return nil
    31  }