Files
matosbox/backend/internal/data/ent/objet/objet.go

277 lines
10 KiB
Go

// Code generated by ent, DO NOT EDIT.
package objet
import (
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
)
const (
// Label holds the string label denoting the objet type in the database.
Label = "objet"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldNom holds the string denoting the nom field in the database.
FieldNom = "nom"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldQuantite holds the string denoting the quantite field in the database.
FieldQuantite = "quantite"
// FieldPrixAchat holds the string denoting the prix_achat field in the database.
FieldPrixAchat = "prix_achat"
// FieldDateAchat holds the string denoting the date_achat field in the database.
FieldDateAchat = "date_achat"
// FieldBoutique holds the string denoting the boutique field in the database.
FieldBoutique = "boutique"
// FieldNumeroSerie holds the string denoting the numero_serie field in the database.
FieldNumeroSerie = "numero_serie"
// FieldNumeroModele holds the string denoting the numero_modele field in the database.
FieldNumeroModele = "numero_modele"
// FieldFabricant holds the string denoting the fabricant field in the database.
FieldFabricant = "fabricant"
// FieldStatut holds the string denoting the statut field in the database.
FieldStatut = "statut"
// FieldCaracteristiques holds the string denoting the caracteristiques field in the database.
FieldCaracteristiques = "caracteristiques"
// 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"
// EdgeLiensEmplacements holds the string denoting the liens_emplacements edge name in mutations.
EdgeLiensEmplacements = "liens_emplacements"
// EdgeChampsPersonnalises holds the string denoting the champs_personnalises edge name in mutations.
EdgeChampsPersonnalises = "champs_personnalises"
// EdgePiecesJointes holds the string denoting the pieces_jointes edge name in mutations.
EdgePiecesJointes = "pieces_jointes"
// Table holds the table name of the objet in the database.
Table = "objet"
// LiensEmplacementsTable is the table that holds the liens_emplacements relation/edge.
LiensEmplacementsTable = "lien_objet_emplacement"
// LiensEmplacementsInverseTable is the table name for the LienObjetEmplacement entity.
// It exists in this package in order to avoid circular dependency with the "lienobjetemplacement" package.
LiensEmplacementsInverseTable = "lien_objet_emplacement"
// LiensEmplacementsColumn is the table column denoting the liens_emplacements relation/edge.
LiensEmplacementsColumn = "objet_id"
// ChampsPersonnalisesTable is the table that holds the champs_personnalises relation/edge.
ChampsPersonnalisesTable = "champ_personnalise"
// ChampsPersonnalisesInverseTable is the table name for the ChampPersonnalise entity.
// It exists in this package in order to avoid circular dependency with the "champpersonnalise" package.
ChampsPersonnalisesInverseTable = "champ_personnalise"
// ChampsPersonnalisesColumn is the table column denoting the champs_personnalises relation/edge.
ChampsPersonnalisesColumn = "objet_id"
// PiecesJointesTable is the table that holds the pieces_jointes relation/edge.
PiecesJointesTable = "piece_jointe"
// PiecesJointesInverseTable is the table name for the PieceJointe entity.
// It exists in this package in order to avoid circular dependency with the "piecejointe" package.
PiecesJointesInverseTable = "piece_jointe"
// PiecesJointesColumn is the table column denoting the pieces_jointes relation/edge.
PiecesJointesColumn = "objet_id"
)
// Columns holds all SQL columns for objet fields.
var Columns = []string{
FieldID,
FieldNom,
FieldDescription,
FieldQuantite,
FieldPrixAchat,
FieldDateAchat,
FieldBoutique,
FieldNumeroSerie,
FieldNumeroModele,
FieldFabricant,
FieldStatut,
FieldCaracteristiques,
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 (
// NomValidator is a validator for the "nom" field. It is called by the builders before save.
NomValidator func(string) error
// DefaultQuantite holds the default value on creation for the "quantite" field.
DefaultQuantite int
// 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
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() uuid.UUID
)
// Statut defines the type for the "statut" enum field.
type Statut string
// StatutEnStock is the default value of the Statut enum.
const DefaultStatut = StatutEnStock
// Statut values.
const (
StatutEnStock Statut = "en_stock"
StatutPret Statut = "pret"
StatutHorsService Statut = "hors_service"
StatutArchive Statut = "archive"
)
func (s Statut) String() string {
return string(s)
}
// StatutValidator is a validator for the "statut" field enum values. It is called by the builders before save.
func StatutValidator(s Statut) error {
switch s {
case StatutEnStock, StatutPret, StatutHorsService, StatutArchive:
return nil
default:
return fmt.Errorf("objet: invalid enum value for statut field: %q", s)
}
}
// OrderOption defines the ordering options for the Objet 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()
}
// ByNom orders the results by the nom field.
func ByNom(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNom, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByQuantite orders the results by the quantite field.
func ByQuantite(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldQuantite, opts...).ToFunc()
}
// ByPrixAchat orders the results by the prix_achat field.
func ByPrixAchat(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPrixAchat, opts...).ToFunc()
}
// ByDateAchat orders the results by the date_achat field.
func ByDateAchat(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDateAchat, opts...).ToFunc()
}
// ByBoutique orders the results by the boutique field.
func ByBoutique(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBoutique, opts...).ToFunc()
}
// ByNumeroSerie orders the results by the numero_serie field.
func ByNumeroSerie(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNumeroSerie, opts...).ToFunc()
}
// ByNumeroModele orders the results by the numero_modele field.
func ByNumeroModele(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNumeroModele, opts...).ToFunc()
}
// ByFabricant orders the results by the fabricant field.
func ByFabricant(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFabricant, opts...).ToFunc()
}
// ByStatut orders the results by the statut field.
func ByStatut(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatut, 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()
}
// ByLiensEmplacementsCount orders the results by liens_emplacements count.
func ByLiensEmplacementsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newLiensEmplacementsStep(), opts...)
}
}
// ByLiensEmplacements orders the results by liens_emplacements terms.
func ByLiensEmplacements(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newLiensEmplacementsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByChampsPersonnalisesCount orders the results by champs_personnalises count.
func ByChampsPersonnalisesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newChampsPersonnalisesStep(), opts...)
}
}
// ByChampsPersonnalises orders the results by champs_personnalises terms.
func ByChampsPersonnalises(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newChampsPersonnalisesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByPiecesJointesCount orders the results by pieces_jointes count.
func ByPiecesJointesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newPiecesJointesStep(), opts...)
}
}
// ByPiecesJointes orders the results by pieces_jointes terms.
func ByPiecesJointes(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newPiecesJointesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newLiensEmplacementsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(LiensEmplacementsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, LiensEmplacementsTable, LiensEmplacementsColumn),
)
}
func newChampsPersonnalisesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ChampsPersonnalisesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, ChampsPersonnalisesTable, ChampsPersonnalisesColumn),
)
}
func newPiecesJointesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(PiecesJointesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, PiecesJointesTable, PiecesJointesColumn),
)
}