// Code generated by ent, DO NOT EDIT. package requestexecution import ( "fmt" "io" "strconv" "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" ) const ( // Label holds the string label denoting the requestexecution type in the database. Label = "request_execution" // FieldID holds the string denoting the id field in the database. FieldID = "id" // 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" // FieldProjectID holds the string denoting the project_id field in the database. FieldProjectID = "project_id" // FieldRequestID holds the string denoting the request_id field in the database. FieldRequestID = "request_id" // FieldChannelID holds the string denoting the channel_id field in the database. FieldChannelID = "channel_id" // FieldDataStorageID holds the string denoting the data_storage_id field in the database. FieldDataStorageID = "data_storage_id" // FieldExternalID holds the string denoting the external_id field in the database. FieldExternalID = "external_id" // FieldModelID holds the string denoting the model_id field in the database. FieldModelID = "model_id" // FieldFormat holds the string denoting the format field in the database. FieldFormat = "format" // FieldRequestBody holds the string denoting the request_body field in the database. FieldRequestBody = "request_body" // FieldResponseBody holds the string denoting the response_body field in the database. FieldResponseBody = "response_body" // FieldResponseChunks holds the string denoting the response_chunks field in the database. FieldResponseChunks = "response_chunks" // FieldErrorMessage holds the string denoting the error_message field in the database. FieldErrorMessage = "error_message" // FieldStatus holds the string denoting the status field in the database. FieldStatus = "status" // FieldStream holds the string denoting the stream field in the database. FieldStream = "stream" // FieldMetricsLatencyMs holds the string denoting the metrics_latency_ms field in the database. FieldMetricsLatencyMs = "metrics_latency_ms" // FieldMetricsFirstTokenLatencyMs holds the string denoting the metrics_first_token_latency_ms field in the database. FieldMetricsFirstTokenLatencyMs = "metrics_first_token_latency_ms" // FieldRequestHeaders holds the string denoting the request_headers field in the database. FieldRequestHeaders = "request_headers" // EdgeRequest holds the string denoting the request edge name in mutations. EdgeRequest = "request" // EdgeChannel holds the string denoting the channel edge name in mutations. EdgeChannel = "channel" // EdgeDataStorage holds the string denoting the data_storage edge name in mutations. EdgeDataStorage = "data_storage" // Table holds the table name of the requestexecution in the database. Table = "request_executions" // RequestTable is the table that holds the request relation/edge. RequestTable = "request_executions" // RequestInverseTable is the table name for the Request entity. // It exists in this package in order to avoid circular dependency with the "request" package. RequestInverseTable = "requests" // RequestColumn is the table column denoting the request relation/edge. RequestColumn = "request_id" // ChannelTable is the table that holds the channel relation/edge. ChannelTable = "request_executions" // ChannelInverseTable is the table name for the Channel entity. // It exists in this package in order to avoid circular dependency with the "channel" package. ChannelInverseTable = "channels" // ChannelColumn is the table column denoting the channel relation/edge. ChannelColumn = "channel_id" // DataStorageTable is the table that holds the data_storage relation/edge. DataStorageTable = "request_executions" // DataStorageInverseTable is the table name for the DataStorage entity. // It exists in this package in order to avoid circular dependency with the "datastorage" package. DataStorageInverseTable = "data_storages" // DataStorageColumn is the table column denoting the data_storage relation/edge. DataStorageColumn = "data_storage_id" ) // Columns holds all SQL columns for requestexecution fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, FieldProjectID, FieldRequestID, FieldChannelID, FieldDataStorageID, FieldExternalID, FieldModelID, FieldFormat, FieldRequestBody, FieldResponseBody, FieldResponseChunks, FieldErrorMessage, FieldStatus, FieldStream, FieldMetricsLatencyMs, FieldMetricsFirstTokenLatencyMs, FieldRequestHeaders, } // 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 ( // 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 // DefaultProjectID holds the default value on creation for the "project_id" field. DefaultProjectID int // DefaultFormat holds the default value on creation for the "format" field. DefaultFormat string // DefaultStream holds the default value on creation for the "stream" field. DefaultStream bool ) // Status defines the type for the "status" enum field. type Status string // Status values. const ( StatusPending Status = "pending" StatusProcessing Status = "processing" StatusCompleted Status = "completed" StatusFailed Status = "failed" StatusCanceled Status = "canceled" ) func (s Status) String() string { return string(s) } // StatusValidator is a validator for the "status" field enum values. It is called by the builders before save. func StatusValidator(s Status) error { switch s { case StatusPending, StatusProcessing, StatusCompleted, StatusFailed, StatusCanceled: return nil default: return fmt.Errorf("requestexecution: invalid enum value for status field: %q", s) } } // OrderOption defines the ordering options for the RequestExecution 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() } // 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() } // ByProjectID orders the results by the project_id field. func ByProjectID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldProjectID, opts...).ToFunc() } // ByRequestID orders the results by the request_id field. func ByRequestID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldRequestID, opts...).ToFunc() } // ByChannelID orders the results by the channel_id field. func ByChannelID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldChannelID, opts...).ToFunc() } // ByDataStorageID orders the results by the data_storage_id field. func ByDataStorageID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDataStorageID, opts...).ToFunc() } // ByExternalID orders the results by the external_id field. func ByExternalID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldExternalID, opts...).ToFunc() } // ByModelID orders the results by the model_id field. func ByModelID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldModelID, opts...).ToFunc() } // ByFormat orders the results by the format field. func ByFormat(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldFormat, opts...).ToFunc() } // ByErrorMessage orders the results by the error_message field. func ByErrorMessage(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldErrorMessage, opts...).ToFunc() } // ByStatus orders the results by the status field. func ByStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStatus, opts...).ToFunc() } // ByStream orders the results by the stream field. func ByStream(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStream, opts...).ToFunc() } // ByMetricsLatencyMs orders the results by the metrics_latency_ms field. func ByMetricsLatencyMs(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMetricsLatencyMs, opts...).ToFunc() } // ByMetricsFirstTokenLatencyMs orders the results by the metrics_first_token_latency_ms field. func ByMetricsFirstTokenLatencyMs(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMetricsFirstTokenLatencyMs, opts...).ToFunc() } // ByRequestField orders the results by request field. func ByRequestField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newRequestStep(), sql.OrderByField(field, opts...)) } } // ByChannelField orders the results by channel field. func ByChannelField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newChannelStep(), sql.OrderByField(field, opts...)) } } // ByDataStorageField orders the results by data_storage field. func ByDataStorageField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newDataStorageStep(), sql.OrderByField(field, opts...)) } } func newRequestStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(RequestInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, RequestTable, RequestColumn), ) } func newChannelStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(ChannelInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, ChannelTable, ChannelColumn), ) } func newDataStorageStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(DataStorageInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, DataStorageTable, DataStorageColumn), ) } // MarshalGQL implements graphql.Marshaler interface. func (e Status) MarshalGQL(w io.Writer) { io.WriteString(w, strconv.Quote(e.String())) } // UnmarshalGQL implements graphql.Unmarshaler interface. func (e *Status) UnmarshalGQL(val interface{}) error { str, ok := val.(string) if !ok { return fmt.Errorf("enum %T must be a string", val) } *e = Status(str) if err := StatusValidator(*e); err != nil { return fmt.Errorf("%s is not a valid Status", str) } return nil }