snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
Atlas CI Public / lint (push) Failing after 13s
Atlas CI Public / sync (push) Has been skipped

This commit is contained in:
upstream-mirror
2026-09-15 22:12:36 +05:00
commit 4b3ad0b611
2680 changed files with 719472 additions and 0 deletions

View File

@@ -0,0 +1,121 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package rental
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the rental type in the database.
Label = "rental"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldDate holds the string denoting the date field in the database.
FieldDate = "date"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldCarID holds the string denoting the car_id field in the database.
FieldCarID = "car_id"
// EdgeUser holds the string denoting the user edge name in mutations.
EdgeUser = "user"
// EdgeCar holds the string denoting the car edge name in mutations.
EdgeCar = "car"
// Table holds the table name of the rental in the database.
Table = "rentals"
// UserTable is the table that holds the user relation/edge.
UserTable = "rentals"
// UserInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
UserInverseTable = "users"
// UserColumn is the table column denoting the user relation/edge.
UserColumn = "user_id"
// CarTable is the table that holds the car relation/edge.
CarTable = "rentals"
// CarInverseTable is the table name for the Car entity.
// It exists in this package in order to avoid circular dependency with the "car" package.
CarInverseTable = "cars"
// CarColumn is the table column denoting the car relation/edge.
CarColumn = "car_id"
)
// Columns holds all SQL columns for rental fields.
var Columns = []string{
FieldID,
FieldDate,
FieldUserID,
FieldCarID,
}
// 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 (
// DefaultDate holds the default value on creation for the "date" field.
DefaultDate func() time.Time
)
// OrderOption defines the ordering options for the Rental 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()
}
// ByDate orders the results by the date field.
func ByDate(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDate, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// ByCarID orders the results by the car_id field.
func ByCarID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCarID, opts...).ToFunc()
}
// ByUserField orders the results by user field.
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
}
}
// ByCarField orders the results by car field.
func ByCarField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newCarStep(), sql.OrderByField(field, opts...))
}
}
func newUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
)
}
func newCarStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(CarInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, CarTable, CarColumn),
)
}