mirror of
https://github.com/rancher/steve.git
synced 2025-08-31 15:11:31 +00:00
Split RegisterAfterUpsert into RegisterAfterAdd and RegisterAfterUpdate (#644)
* Split RegisterAfterUpsert into two We're going to need to be able to differentiate between Add and Update for storing events in the _events table. * Update mocks
This commit is contained in:
@@ -70,7 +70,8 @@ type Store interface {
|
||||
|
||||
GetByKey(key string) (item any, exists bool, err error)
|
||||
GetName() string
|
||||
RegisterAfterUpsert(f func(key string, obj any, tx transaction.Client) error)
|
||||
RegisterAfterAdd(f func(key string, obj any, tx transaction.Client) error)
|
||||
RegisterAfterUpdate(f func(key string, obj any, tx transaction.Client) error)
|
||||
RegisterAfterDelete(f func(key string, tx transaction.Client) error)
|
||||
GetShouldEncrypt() bool
|
||||
GetType() reflect.Type
|
||||
@@ -102,7 +103,8 @@ func NewIndexer(ctx context.Context, indexers cache.Indexers, s Store) (*Indexer
|
||||
Store: s,
|
||||
indexers: indexers,
|
||||
}
|
||||
i.RegisterAfterUpsert(i.AfterUpsert)
|
||||
i.RegisterAfterAdd(i.AfterUpsert)
|
||||
i.RegisterAfterUpdate(i.AfterUpsert)
|
||||
|
||||
i.deleteIndicesQuery = fmt.Sprintf(deleteIndicesFmt, db.Sanitize(s.GetName()))
|
||||
i.addIndexQuery = fmt.Sprintf(addIndexFmt, db.Sanitize(s.GetName()))
|
||||
|
Reference in New Issue
Block a user