mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-17 23:03:56 +02:00
* orm: correct behavior of created_at, updated_at, define immutable fields * remove updatedefault for last_push, last_heartbeat * re-generate db schema * update last_push in CreateAlert() * lint
146 lines
4.9 KiB
Go
146 lines
4.9 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package bouncer
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the bouncer type in the database.
|
|
Label = "bouncer"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
FieldCreatedAt = "created_at"
|
|
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
|
FieldUpdatedAt = "updated_at"
|
|
// FieldName holds the string denoting the name field in the database.
|
|
FieldName = "name"
|
|
// FieldAPIKey holds the string denoting the api_key field in the database.
|
|
FieldAPIKey = "api_key"
|
|
// FieldRevoked holds the string denoting the revoked field in the database.
|
|
FieldRevoked = "revoked"
|
|
// FieldIPAddress holds the string denoting the ip_address field in the database.
|
|
FieldIPAddress = "ip_address"
|
|
// FieldType holds the string denoting the type field in the database.
|
|
FieldType = "type"
|
|
// FieldVersion holds the string denoting the version field in the database.
|
|
FieldVersion = "version"
|
|
// FieldUntil holds the string denoting the until field in the database.
|
|
FieldUntil = "until"
|
|
// FieldLastPull holds the string denoting the last_pull field in the database.
|
|
FieldLastPull = "last_pull"
|
|
// FieldAuthType holds the string denoting the auth_type field in the database.
|
|
FieldAuthType = "auth_type"
|
|
// Table holds the table name of the bouncer in the database.
|
|
Table = "bouncers"
|
|
)
|
|
|
|
// Columns holds all SQL columns for bouncer fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
FieldName,
|
|
FieldAPIKey,
|
|
FieldRevoked,
|
|
FieldIPAddress,
|
|
FieldType,
|
|
FieldVersion,
|
|
FieldUntil,
|
|
FieldLastPull,
|
|
FieldAuthType,
|
|
}
|
|
|
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
|
func ValidColumn(column string) bool {
|
|
for i := range Columns {
|
|
if column == Columns[i] {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
var (
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt func() time.Time
|
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
|
DefaultUpdatedAt func() time.Time
|
|
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
|
UpdateDefaultUpdatedAt func() time.Time
|
|
// DefaultIPAddress holds the default value on creation for the "ip_address" field.
|
|
DefaultIPAddress string
|
|
// DefaultUntil holds the default value on creation for the "until" field.
|
|
DefaultUntil func() time.Time
|
|
// DefaultLastPull holds the default value on creation for the "last_pull" field.
|
|
DefaultLastPull func() time.Time
|
|
// DefaultAuthType holds the default value on creation for the "auth_type" field.
|
|
DefaultAuthType string
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Bouncer queries.
|
|
type OrderOption func(*sql.Selector)
|
|
|
|
// ByID orders the results by the id field.
|
|
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUpdatedAt orders the results by the updated_at field.
|
|
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByName orders the results by the name field.
|
|
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByAPIKey orders the results by the api_key field.
|
|
func ByAPIKey(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldAPIKey, opts...).ToFunc()
|
|
}
|
|
|
|
// ByRevoked orders the results by the revoked field.
|
|
func ByRevoked(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldRevoked, opts...).ToFunc()
|
|
}
|
|
|
|
// ByIPAddress orders the results by the ip_address field.
|
|
func ByIPAddress(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldIPAddress, opts...).ToFunc()
|
|
}
|
|
|
|
// ByType orders the results by the type field.
|
|
func ByType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldType, opts...).ToFunc()
|
|
}
|
|
|
|
// ByVersion orders the results by the version field.
|
|
func ByVersion(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldVersion, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUntil orders the results by the until field.
|
|
func ByUntil(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUntil, opts...).ToFunc()
|
|
}
|
|
|
|
// ByLastPull orders the results by the last_pull field.
|
|
func ByLastPull(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldLastPull, opts...).ToFunc()
|
|
}
|
|
|
|
// ByAuthType orders the results by the auth_type field.
|
|
func ByAuthType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldAuthType, opts...).ToFunc()
|
|
}
|