MCPcopy Create free account
hub / github.com/crowdsecurity/crowdsec / sqlSave

Method sqlSave

pkg/database/ent/alert_update.go:215–464  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

213}
214
215func (_u *AlertUpdate) sqlSave(ctx context.Context) (_node int, err error) {
216 _spec := sqlgraph.NewUpdateSpec(alert.Table, alert.Columns, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt))
217 if ps := _u.mutation.predicates; len(ps) > 0 {
218 _spec.Predicate = func(selector *sql.Selector) {
219 for i := range ps {
220 ps[i](selector)
221 }
222 }
223 }
224 if value, ok := _u.mutation.UpdatedAt(); ok {
225 _spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value)
226 }
227 if _u.mutation.BucketIdCleared() {
228 _spec.ClearField(alert.FieldBucketId, field.TypeString)
229 }
230 if _u.mutation.MessageCleared() {
231 _spec.ClearField(alert.FieldMessage, field.TypeString)
232 }
233 if _u.mutation.EventsCountCleared() {
234 _spec.ClearField(alert.FieldEventsCount, field.TypeInt32)
235 }
236 if _u.mutation.StartedAtCleared() {
237 _spec.ClearField(alert.FieldStartedAt, field.TypeTime)
238 }
239 if _u.mutation.StoppedAtCleared() {
240 _spec.ClearField(alert.FieldStoppedAt, field.TypeTime)
241 }
242 if _u.mutation.SourceIpCleared() {
243 _spec.ClearField(alert.FieldSourceIp, field.TypeString)
244 }
245 if _u.mutation.SourceRangeCleared() {
246 _spec.ClearField(alert.FieldSourceRange, field.TypeString)
247 }
248 if _u.mutation.SourceAsNumberCleared() {
249 _spec.ClearField(alert.FieldSourceAsNumber, field.TypeString)
250 }
251 if _u.mutation.SourceAsNameCleared() {
252 _spec.ClearField(alert.FieldSourceAsName, field.TypeString)
253 }
254 if _u.mutation.SourceCountryCleared() {
255 _spec.ClearField(alert.FieldSourceCountry, field.TypeString)
256 }
257 if _u.mutation.SourceLatitudeCleared() {
258 _spec.ClearField(alert.FieldSourceLatitude, field.TypeFloat32)
259 }
260 if _u.mutation.SourceLongitudeCleared() {
261 _spec.ClearField(alert.FieldSourceLongitude, field.TypeFloat32)
262 }
263 if _u.mutation.SourceScopeCleared() {
264 _spec.ClearField(alert.FieldSourceScope, field.TypeString)
265 }
266 if _u.mutation.SourceValueCleared() {
267 _spec.ClearField(alert.FieldSourceValue, field.TypeString)
268 }
269 if _u.mutation.CapacityCleared() {
270 _spec.ClearField(alert.FieldCapacity, field.TypeInt32)
271 }
272 if _u.mutation.LeakSpeedCleared() {

Callers

nothing calls this directly

Calls 15

BucketIdClearedMethod · 0.80
MessageClearedMethod · 0.80
EventsCountClearedMethod · 0.80
StartedAtClearedMethod · 0.80
StoppedAtClearedMethod · 0.80
SourceIpClearedMethod · 0.80
SourceRangeClearedMethod · 0.80
SourceAsNumberClearedMethod · 0.80
SourceAsNameClearedMethod · 0.80
SourceCountryClearedMethod · 0.80
SourceLatitudeClearedMethod · 0.80

Tested by

no test coverage detected