-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
logsummarizations.go
227 lines (216 loc) · 9.06 KB
/
logsummarizations.go
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
// Code generated by ent, DO NOT EDIT.
package ent
import (
"fmt"
"strings"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/google/uuid"
"github.com/nekomeowww/insights-bot/ent/logsummarizations"
)
// LogSummarizations is the model entity for the LogSummarizations schema.
type LogSummarizations struct {
config `json:"-"`
// ID of the ent.
ID uuid.UUID `json:"id,omitempty"`
// ContentURL holds the value of the "content_url" field.
ContentURL string `json:"content_url,omitempty"`
// ContentTitle holds the value of the "content_title" field.
ContentTitle string `json:"content_title,omitempty"`
// ContentAuthor holds the value of the "content_author" field.
ContentAuthor string `json:"content_author,omitempty"`
// ContentText holds the value of the "content_text" field.
ContentText string `json:"content_text,omitempty"`
// ContentSummarizedOutputs holds the value of the "content_summarized_outputs" field.
ContentSummarizedOutputs string `json:"content_summarized_outputs,omitempty"`
// FromPlatform holds the value of the "from_platform" field.
FromPlatform int `json:"from_platform,omitempty"`
// PromptTokenUsage holds the value of the "prompt_token_usage" field.
PromptTokenUsage int `json:"prompt_token_usage,omitempty"`
// CompletionTokenUsage holds the value of the "completion_token_usage" field.
CompletionTokenUsage int `json:"completion_token_usage,omitempty"`
// TotalTokenUsage holds the value of the "total_token_usage" field.
TotalTokenUsage int `json:"total_token_usage,omitempty"`
// ModelName holds the value of the "model_name" field.
ModelName string `json:"model_name,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt int64 `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt int64 `json:"updated_at,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*LogSummarizations) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case logsummarizations.FieldFromPlatform, logsummarizations.FieldPromptTokenUsage, logsummarizations.FieldCompletionTokenUsage, logsummarizations.FieldTotalTokenUsage, logsummarizations.FieldCreatedAt, logsummarizations.FieldUpdatedAt:
values[i] = new(sql.NullInt64)
case logsummarizations.FieldContentURL, logsummarizations.FieldContentTitle, logsummarizations.FieldContentAuthor, logsummarizations.FieldContentText, logsummarizations.FieldContentSummarizedOutputs, logsummarizations.FieldModelName:
values[i] = new(sql.NullString)
case logsummarizations.FieldID:
values[i] = new(uuid.UUID)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the LogSummarizations fields.
func (ls *LogSummarizations) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case logsummarizations.FieldID:
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
ls.ID = *value
}
case logsummarizations.FieldContentURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field content_url", values[i])
} else if value.Valid {
ls.ContentURL = value.String
}
case logsummarizations.FieldContentTitle:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field content_title", values[i])
} else if value.Valid {
ls.ContentTitle = value.String
}
case logsummarizations.FieldContentAuthor:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field content_author", values[i])
} else if value.Valid {
ls.ContentAuthor = value.String
}
case logsummarizations.FieldContentText:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field content_text", values[i])
} else if value.Valid {
ls.ContentText = value.String
}
case logsummarizations.FieldContentSummarizedOutputs:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field content_summarized_outputs", values[i])
} else if value.Valid {
ls.ContentSummarizedOutputs = value.String
}
case logsummarizations.FieldFromPlatform:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field from_platform", values[i])
} else if value.Valid {
ls.FromPlatform = int(value.Int64)
}
case logsummarizations.FieldPromptTokenUsage:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field prompt_token_usage", values[i])
} else if value.Valid {
ls.PromptTokenUsage = int(value.Int64)
}
case logsummarizations.FieldCompletionTokenUsage:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field completion_token_usage", values[i])
} else if value.Valid {
ls.CompletionTokenUsage = int(value.Int64)
}
case logsummarizations.FieldTotalTokenUsage:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field total_token_usage", values[i])
} else if value.Valid {
ls.TotalTokenUsage = int(value.Int64)
}
case logsummarizations.FieldModelName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field model_name", values[i])
} else if value.Valid {
ls.ModelName = value.String
}
case logsummarizations.FieldCreatedAt:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
ls.CreatedAt = value.Int64
}
case logsummarizations.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
ls.UpdatedAt = value.Int64
}
default:
ls.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the LogSummarizations.
// This includes values selected through modifiers, order, etc.
func (ls *LogSummarizations) Value(name string) (ent.Value, error) {
return ls.selectValues.Get(name)
}
// Update returns a builder for updating this LogSummarizations.
// Note that you need to call LogSummarizations.Unwrap() before calling this method if this LogSummarizations
// was returned from a transaction, and the transaction was committed or rolled back.
func (ls *LogSummarizations) Update() *LogSummarizationsUpdateOne {
return NewLogSummarizationsClient(ls.config).UpdateOne(ls)
}
// Unwrap unwraps the LogSummarizations entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (ls *LogSummarizations) Unwrap() *LogSummarizations {
_tx, ok := ls.config.driver.(*txDriver)
if !ok {
panic("ent: LogSummarizations is not a transactional entity")
}
ls.config.driver = _tx.drv
return ls
}
// String implements the fmt.Stringer.
func (ls *LogSummarizations) String() string {
var builder strings.Builder
builder.WriteString("LogSummarizations(")
builder.WriteString(fmt.Sprintf("id=%v, ", ls.ID))
builder.WriteString("content_url=")
builder.WriteString(ls.ContentURL)
builder.WriteString(", ")
builder.WriteString("content_title=")
builder.WriteString(ls.ContentTitle)
builder.WriteString(", ")
builder.WriteString("content_author=")
builder.WriteString(ls.ContentAuthor)
builder.WriteString(", ")
builder.WriteString("content_text=")
builder.WriteString(ls.ContentText)
builder.WriteString(", ")
builder.WriteString("content_summarized_outputs=")
builder.WriteString(ls.ContentSummarizedOutputs)
builder.WriteString(", ")
builder.WriteString("from_platform=")
builder.WriteString(fmt.Sprintf("%v", ls.FromPlatform))
builder.WriteString(", ")
builder.WriteString("prompt_token_usage=")
builder.WriteString(fmt.Sprintf("%v", ls.PromptTokenUsage))
builder.WriteString(", ")
builder.WriteString("completion_token_usage=")
builder.WriteString(fmt.Sprintf("%v", ls.CompletionTokenUsage))
builder.WriteString(", ")
builder.WriteString("total_token_usage=")
builder.WriteString(fmt.Sprintf("%v", ls.TotalTokenUsage))
builder.WriteString(", ")
builder.WriteString("model_name=")
builder.WriteString(ls.ModelName)
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(fmt.Sprintf("%v", ls.CreatedAt))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(fmt.Sprintf("%v", ls.UpdatedAt))
builder.WriteByte(')')
return builder.String()
}
// LogSummarizationsSlice is a parsable slice of LogSummarizations.
type LogSummarizationsSlice []*LogSummarizations