121 lines
4.1 KiB
Go
121 lines
4.1 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|||
|
|
|
||
|
|
package alertrule
|
||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"entgo.io/ent/dialect/sql"
|
||
|
|
)
|
||
|
|
|
||
|
|
const (
|
||
|
|
// Label holds the string label denoting the alertrule type in the database.
|
||
|
|
Label = "alert_rule"
|
||
|
|
// FieldID holds the string denoting the id field in the database.
|
||
|
|
FieldID = "id"
|
||
|
|
// FieldName holds the string denoting the name field in the database.
|
||
|
|
FieldName = "name"
|
||
|
|
// FieldType holds the string denoting the type field in the database.
|
||
|
|
FieldType = "type"
|
||
|
|
// FieldThreshold holds the string denoting the threshold field in the database.
|
||
|
|
FieldThreshold = "threshold"
|
||
|
|
// FieldReceiver holds the string denoting the receiver field in the database.
|
||
|
|
FieldReceiver = "receiver"
|
||
|
|
// FieldEnabled holds the string denoting the enabled field in the database.
|
||
|
|
FieldEnabled = "enabled"
|
||
|
|
// FieldCreatedBy holds the string denoting the createdby field in the database.
|
||
|
|
FieldCreatedBy = "created_by"
|
||
|
|
// FieldCreatedAt holds the string denoting the createdat field in the database.
|
||
|
|
FieldCreatedAt = "created_at"
|
||
|
|
// Table holds the table name of the alertrule in the database.
|
||
|
|
Table = "alert_rule"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Columns holds all SQL columns for alertrule fields.
|
||
|
|
var Columns = []string{
|
||
|
|
FieldID,
|
||
|
|
FieldName,
|
||
|
|
FieldType,
|
||
|
|
FieldThreshold,
|
||
|
|
FieldReceiver,
|
||
|
|
FieldEnabled,
|
||
|
|
FieldCreatedBy,
|
||
|
|
FieldCreatedAt,
|
||
|
|
}
|
||
|
|
|
||
|
|
// 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 (
|
||
|
|
// NameValidator is a validator for the "name" field. It is called by the builders before save.
|
||
|
|
NameValidator func(string) error
|
||
|
|
// TypeValidator is a validator for the "type" field. It is called by the builders before save.
|
||
|
|
TypeValidator func(string) error
|
||
|
|
// DefaultThreshold holds the default value on creation for the "threshold" field.
|
||
|
|
DefaultThreshold float64
|
||
|
|
// DefaultReceiver holds the default value on creation for the "receiver" field.
|
||
|
|
DefaultReceiver string
|
||
|
|
// ReceiverValidator is a validator for the "receiver" field. It is called by the builders before save.
|
||
|
|
ReceiverValidator func(string) error
|
||
|
|
// DefaultEnabled holds the default value on creation for the "enabled" field.
|
||
|
|
DefaultEnabled bool
|
||
|
|
// DefaultCreatedBy holds the default value on creation for the "createdBy" field.
|
||
|
|
DefaultCreatedBy string
|
||
|
|
// CreatedByValidator is a validator for the "createdBy" field. It is called by the builders before save.
|
||
|
|
CreatedByValidator func(string) error
|
||
|
|
// DefaultCreatedAt holds the default value on creation for the "createdAt" field.
|
||
|
|
DefaultCreatedAt func() time.Time
|
||
|
|
// IDValidator is a validator for the "id" field. It is called by the builders before save.
|
||
|
|
IDValidator func(int) error
|
||
|
|
)
|
||
|
|
|
||
|
|
// OrderOption defines the ordering options for the AlertRule 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()
|
||
|
|
}
|
||
|
|
|
||
|
|
// ByName orders the results by the name field.
|
||
|
|
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
||
|
|
return sql.OrderByField(FieldName, opts...).ToFunc()
|
||
|
|
}
|
||
|
|
|
||
|
|
// ByType orders the results by the type field.
|
||
|
|
func ByType(opts ...sql.OrderTermOption) OrderOption {
|
||
|
|
return sql.OrderByField(FieldType, opts...).ToFunc()
|
||
|
|
}
|
||
|
|
|
||
|
|
// ByThreshold orders the results by the threshold field.
|
||
|
|
func ByThreshold(opts ...sql.OrderTermOption) OrderOption {
|
||
|
|
return sql.OrderByField(FieldThreshold, opts...).ToFunc()
|
||
|
|
}
|
||
|
|
|
||
|
|
// ByReceiver orders the results by the receiver field.
|
||
|
|
func ByReceiver(opts ...sql.OrderTermOption) OrderOption {
|
||
|
|
return sql.OrderByField(FieldReceiver, opts...).ToFunc()
|
||
|
|
}
|
||
|
|
|
||
|
|
// ByEnabled orders the results by the enabled field.
|
||
|
|
func ByEnabled(opts ...sql.OrderTermOption) OrderOption {
|
||
|
|
return sql.OrderByField(FieldEnabled, opts...).ToFunc()
|
||
|
|
}
|
||
|
|
|
||
|
|
// ByCreatedBy orders the results by the createdBy field.
|
||
|
|
func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
|
||
|
|
return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
|
||
|
|
}
|
||
|
|
|
||
|
|
// ByCreatedAt orders the results by the createdAt field.
|
||
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
||
|
|
}
|