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

     1  package schema
     2  
     3  import (
     4  	"time"
     5  
     6  	"entgo.io/ent"
     7  	"entgo.io/ent/schema/field"
     8  )
     9  
    10  // Bouncer holds the schema definition for the Bouncer entity.
    11  type Bouncer struct {
    12  	ent.Schema
    13  }
    14  
    15  // Fields of the Bouncer.
    16  func (Bouncer) Fields() []ent.Field {
    17  	return []ent.Field{
    18  		field.Time("created_at").
    19  			Default(time.Now),
    20  		field.Time("updated_at").
    21  			Default(time.Now),
    22  		field.String("name").Unique(),
    23  		field.String("api_key"), // hash of api_key
    24  		field.Bool("revoked"),
    25  		field.String("ip_address").Default("").Optional(),
    26  		field.String("type").Optional(),
    27  		field.String("version").Optional(),
    28  		field.Time("until").Default(time.Now).Optional(),
    29  		field.Time("last_pull").
    30  			Default(time.Now),
    31  	}
    32  }
    33  
    34  // Edges of the Bouncer.
    35  func (Bouncer) Edges() []ent.Edge {
    36  	return nil
    37  }