87 lines
2.4 KiB
Go
87 lines
2.4 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package visit
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the visit type in the database.
|
|
Label = "visit"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldPath holds the string denoting the path field in the database.
|
|
FieldPath = "path"
|
|
// FieldIP holds the string denoting the ip field in the database.
|
|
FieldIP = "ip"
|
|
// FieldUserAgent holds the string denoting the user_agent field in the database.
|
|
FieldUserAgent = "user_agent"
|
|
// FieldReferer holds the string denoting the referer field in the database.
|
|
FieldReferer = "referer"
|
|
// FieldVisitTime holds the string denoting the visit_time field in the database.
|
|
FieldVisitTime = "visit_time"
|
|
// Table holds the table name of the visit in the database.
|
|
Table = "visits"
|
|
)
|
|
|
|
// Columns holds all SQL columns for visit fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldPath,
|
|
FieldIP,
|
|
FieldUserAgent,
|
|
FieldReferer,
|
|
FieldVisitTime,
|
|
}
|
|
|
|
// 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 (
|
|
// DefaultVisitTime holds the default value on creation for the "visit_time" field.
|
|
DefaultVisitTime func() time.Time
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Visit 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()
|
|
}
|
|
|
|
// ByPath orders the results by the path field.
|
|
func ByPath(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldPath, opts...).ToFunc()
|
|
}
|
|
|
|
// ByIP orders the results by the ip field.
|
|
func ByIP(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldIP, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUserAgent orders the results by the user_agent field.
|
|
func ByUserAgent(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUserAgent, opts...).ToFunc()
|
|
}
|
|
|
|
// ByReferer orders the results by the referer field.
|
|
func ByReferer(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldReferer, opts...).ToFunc()
|
|
}
|
|
|
|
// ByVisitTime orders the results by the visit_time field.
|
|
func ByVisitTime(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldVisitTime, opts...).ToFunc()
|
|
}
|