119 lines
3.9 KiB
Go
119 lines
3.9 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package alert
|
|
|
|
import (
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the alert type in the database.
|
|
Label = "alert"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldRuleCode holds the string denoting the rule_code field in the database.
|
|
FieldRuleCode = "rule_code"
|
|
// FieldLevel holds the string denoting the level field in the database.
|
|
FieldLevel = "level"
|
|
// FieldTitle holds the string denoting the title field in the database.
|
|
FieldTitle = "title"
|
|
// FieldContent holds the string denoting the content field in the database.
|
|
FieldContent = "content"
|
|
// FieldTarget holds the string denoting the target field in the database.
|
|
FieldTarget = "target"
|
|
// FieldStatus holds the string denoting the status field in the database.
|
|
FieldStatus = "status"
|
|
// 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"
|
|
// Table holds the table name of the alert in the database.
|
|
Table = "alerts"
|
|
)
|
|
|
|
// Columns holds all SQL columns for alert fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldRuleCode,
|
|
FieldLevel,
|
|
FieldTitle,
|
|
FieldContent,
|
|
FieldTarget,
|
|
FieldStatus,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
}
|
|
|
|
// 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 (
|
|
// DefaultLevel holds the default value on creation for the "level" field.
|
|
DefaultLevel string
|
|
// LevelValidator is a validator for the "level" field. It is called by the builders before save.
|
|
LevelValidator func(string) error
|
|
// DefaultStatus holds the default value on creation for the "status" field.
|
|
DefaultStatus string
|
|
// StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
|
StatusValidator func(string) error
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt func() int64
|
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
|
DefaultUpdatedAt func() int64
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Alert 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()
|
|
}
|
|
|
|
// ByRuleCode orders the results by the rule_code field.
|
|
func ByRuleCode(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldRuleCode, opts...).ToFunc()
|
|
}
|
|
|
|
// ByLevel orders the results by the level field.
|
|
func ByLevel(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldLevel, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTitle orders the results by the title field.
|
|
func ByTitle(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTitle, opts...).ToFunc()
|
|
}
|
|
|
|
// ByContent orders the results by the content field.
|
|
func ByContent(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldContent, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTarget orders the results by the target field.
|
|
func ByTarget(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTarget, opts...).ToFunc()
|
|
}
|
|
|
|
// ByStatus orders the results by the status field.
|
|
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldStatus, 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()
|
|
}
|