github.com/crowdsecurity/crowdsec@v1.6.1/pkg/database/ent/schema/bouncer.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 // Bouncer holds the schema definition for the Bouncer entity. 10 type Bouncer struct { 11 ent.Schema 12 } 13 14 // Fields of the Bouncer. 15 func (Bouncer) 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("api_key").Sensitive(), // hash of api_key 25 field.Bool("revoked").StructTag(`json:"revoked"`), 26 field.String("ip_address").Default("").Optional().StructTag(`json:"ip_address"`), 27 field.String("type").Optional().StructTag(`json:"type"`), 28 field.String("version").Optional().StructTag(`json:"version"`), 29 field.Time("until").Default(types.UtcNow).Optional().StructTag(`json:"until"`), 30 field.Time("last_pull"). 31 Default(types.UtcNow).StructTag(`json:"last_pull"`), 32 field.String("auth_type").StructTag(`json:"auth_type"`).Default(types.ApiKeyAuthType), 33 } 34 } 35 36 // Edges of the Bouncer. 37 func (Bouncer) Edges() []ent.Edge { 38 return nil 39 }