File size: 11,443 Bytes
9853396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
// 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
}