MCPcopy Index your code
hub / github.com/crowdsecurity/crowdsec / IDs

Method IDs

pkg/database/ent/mutation.go:186–199  ·  view source on GitHub ↗

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

(ctx context.Context)

Source from the content-addressed store, hash-verified

184// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
185// or updated by the mutation.
186func (m *AlertMutation) IDs(ctx context.Context) ([]int, error) {
187 switch {
188 case m.op.Is(OpUpdateOne | OpDeleteOne):
189 id, exists := m.ID()
190 if exists {
191 return []int{id}, nil
192 }
193 fallthrough
194 case m.op.Is(OpUpdate | OpDelete):
195 return m.Client().Alert.Query().Where(m.predicates...).IDs(ctx)
196 default:
197 return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
198 }
199}
200
201// SetCreatedAt sets the "created_at" field.
202func (m *AlertMutation) SetCreatedAt(t time.Time) {

Callers

nothing calls this directly

Calls 5

IDMethod · 0.95
ClientMethod · 0.95
IDsMethod · 0.45
WhereMethod · 0.45
QueryMethod · 0.45

Tested by

no test coverage detected