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

     1  // Code generated by ent, DO NOT EDIT.
     2  
     3  package bouncer
     4  
     5  import (
     6  	"time"
     7  
     8  	"entgo.io/ent/dialect/sql"
     9  )
    10  
    11  const (
    12  	// Label holds the string label denoting the bouncer type in the database.
    13  	Label = "bouncer"
    14  	// FieldID holds the string denoting the id field in the database.
    15  	FieldID = "id"
    16  	// FieldCreatedAt holds the string denoting the created_at field in the database.
    17  	FieldCreatedAt = "created_at"
    18  	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
    19  	FieldUpdatedAt = "updated_at"
    20  	// FieldName holds the string denoting the name field in the database.
    21  	FieldName = "name"
    22  	// FieldAPIKey holds the string denoting the api_key field in the database.
    23  	FieldAPIKey = "api_key"
    24  	// FieldRevoked holds the string denoting the revoked field in the database.
    25  	FieldRevoked = "revoked"
    26  	// FieldIPAddress holds the string denoting the ip_address field in the database.
    27  	FieldIPAddress = "ip_address"
    28  	// FieldType holds the string denoting the type field in the database.
    29  	FieldType = "type"
    30  	// FieldVersion holds the string denoting the version field in the database.
    31  	FieldVersion = "version"
    32  	// FieldUntil holds the string denoting the until field in the database.
    33  	FieldUntil = "until"
    34  	// FieldLastPull holds the string denoting the last_pull field in the database.
    35  	FieldLastPull = "last_pull"
    36  	// FieldAuthType holds the string denoting the auth_type field in the database.
    37  	FieldAuthType = "auth_type"
    38  	// Table holds the table name of the bouncer in the database.
    39  	Table = "bouncers"
    40  )
    41  
    42  // Columns holds all SQL columns for bouncer fields.
    43  var Columns = []string{
    44  	FieldID,
    45  	FieldCreatedAt,
    46  	FieldUpdatedAt,
    47  	FieldName,
    48  	FieldAPIKey,
    49  	FieldRevoked,
    50  	FieldIPAddress,
    51  	FieldType,
    52  	FieldVersion,
    53  	FieldUntil,
    54  	FieldLastPull,
    55  	FieldAuthType,
    56  }
    57  
    58  // ValidColumn reports if the column name is valid (part of the table columns).
    59  func ValidColumn(column string) bool {
    60  	for i := range Columns {
    61  		if column == Columns[i] {
    62  			return true
    63  		}
    64  	}
    65  	return false
    66  }
    67  
    68  var (
    69  	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
    70  	DefaultCreatedAt func() time.Time
    71  	// UpdateDefaultCreatedAt holds the default value on update for the "created_at" field.
    72  	UpdateDefaultCreatedAt func() time.Time
    73  	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
    74  	DefaultUpdatedAt func() time.Time
    75  	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
    76  	UpdateDefaultUpdatedAt func() time.Time
    77  	// DefaultIPAddress holds the default value on creation for the "ip_address" field.
    78  	DefaultIPAddress string
    79  	// DefaultUntil holds the default value on creation for the "until" field.
    80  	DefaultUntil func() time.Time
    81  	// DefaultLastPull holds the default value on creation for the "last_pull" field.
    82  	DefaultLastPull func() time.Time
    83  	// DefaultAuthType holds the default value on creation for the "auth_type" field.
    84  	DefaultAuthType string
    85  )
    86  
    87  // OrderOption defines the ordering options for the Bouncer queries.
    88  type OrderOption func(*sql.Selector)
    89  
    90  // ByID orders the results by the id field.
    91  func ByID(opts ...sql.OrderTermOption) OrderOption {
    92  	return sql.OrderByField(FieldID, opts...).ToFunc()
    93  }
    94  
    95  // ByCreatedAt orders the results by the created_at field.
    96  func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
    97  	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
    98  }
    99  
   100  // ByUpdatedAt orders the results by the updated_at field.
   101  func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
   102  	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
   103  }
   104  
   105  // ByName orders the results by the name field.
   106  func ByName(opts ...sql.OrderTermOption) OrderOption {
   107  	return sql.OrderByField(FieldName, opts...).ToFunc()
   108  }
   109  
   110  // ByAPIKey orders the results by the api_key field.
   111  func ByAPIKey(opts ...sql.OrderTermOption) OrderOption {
   112  	return sql.OrderByField(FieldAPIKey, opts...).ToFunc()
   113  }
   114  
   115  // ByRevoked orders the results by the revoked field.
   116  func ByRevoked(opts ...sql.OrderTermOption) OrderOption {
   117  	return sql.OrderByField(FieldRevoked, opts...).ToFunc()
   118  }
   119  
   120  // ByIPAddress orders the results by the ip_address field.
   121  func ByIPAddress(opts ...sql.OrderTermOption) OrderOption {
   122  	return sql.OrderByField(FieldIPAddress, opts...).ToFunc()
   123  }
   124  
   125  // ByType orders the results by the type field.
   126  func ByType(opts ...sql.OrderTermOption) OrderOption {
   127  	return sql.OrderByField(FieldType, opts...).ToFunc()
   128  }
   129  
   130  // ByVersion orders the results by the version field.
   131  func ByVersion(opts ...sql.OrderTermOption) OrderOption {
   132  	return sql.OrderByField(FieldVersion, opts...).ToFunc()
   133  }
   134  
   135  // ByUntil orders the results by the until field.
   136  func ByUntil(opts ...sql.OrderTermOption) OrderOption {
   137  	return sql.OrderByField(FieldUntil, opts...).ToFunc()
   138  }
   139  
   140  // ByLastPull orders the results by the last_pull field.
   141  func ByLastPull(opts ...sql.OrderTermOption) OrderOption {
   142  	return sql.OrderByField(FieldLastPull, opts...).ToFunc()
   143  }
   144  
   145  // ByAuthType orders the results by the auth_type field.
   146  func ByAuthType(opts ...sql.OrderTermOption) OrderOption {
   147  	return sql.OrderByField(FieldAuthType, opts...).ToFunc()
   148  }