watcher

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitWatcher

func InitWatcher(ctx context.Context)

func RegisterConsumer

func RegisterConsumer(ctx context.Context, id string, filters ...common.PayloadFilterFunc) (common.Consumer, error)

func RegisterProducer

func RegisterProducer(ctx context.Context, id string) (common.Producer, error)

func WithAll

WithAll returns a filter function that returns true if all of the provided filters return true.

func WithAny

WithAny returns a filter function that returns true if any of the provided filters return true. This filter is useful if for example you want to watch for update operations on any of the supplied entities. Example:

// Watch for any update operation on repositories or organizations
consumer.SetFilters(
	watcher.WithOperationTypeFilter(common.UpdateOperation),
	watcher.WithAny(
		watcher.WithEntityTypeFilter(common.RepositoryEntityType),
		watcher.WithEntityTypeFilter(common.OrganizationEntityType),
))

func WithEntityFilter

func WithEntityFilter(entity params.GithubEntity) dbCommon.PayloadFilterFunc

WithEntityFilter returns a filter function that filters payloads by entity. Change payloads that match the entity type and ID will return true.

func WithEntityJobFilter

func WithEntityJobFilter(ghEntity params.GithubEntity) dbCommon.PayloadFilterFunc

func WithEntityPoolFilter

func WithEntityPoolFilter(ghEntity params.GithubEntity) dbCommon.PayloadFilterFunc

WithEntityPoolFilter returns true if the change payload is a pool that belongs to the supplied Github entity. This is useful when an entity worker wants to watch for changes in pools that belong to it.

func WithEntityTypeFilter

func WithEntityTypeFilter(entityType dbCommon.DatabaseEntityType) dbCommon.PayloadFilterFunc

WithEntityTypeFilter returns a filter function that filters payloads by entity type. The filter function returns true if the payload's entity type matches the provided entity type.

func WithEverything

func WithEverything() dbCommon.PayloadFilterFunc

WithEverything returns a filter function that always returns true.

func WithExcludeEntityTypeFilter

func WithExcludeEntityTypeFilter(entityType dbCommon.DatabaseEntityType) dbCommon.PayloadFilterFunc

WithExcludeEntityTypeFilter returns a filter function that filters payloads by excluding the provided entity type.

func WithGithubCredentialsFilter

func WithGithubCredentialsFilter(creds params.GithubCredentials) dbCommon.PayloadFilterFunc

WithGithubCredentialsFilter returns a filter function that filters payloads by Github credentials.

func WithNone

func WithNone() dbCommon.PayloadFilterFunc

WithNone returns a filter function that always returns false.

func WithOperationTypeFilter

func WithOperationTypeFilter(operationType dbCommon.OperationType) dbCommon.PayloadFilterFunc

WithOperationTypeFilter returns a filter function that filters payloads by operation type.

func WithUserIDFilter

func WithUserIDFilter(userID string) dbCommon.PayloadFilterFunc

WithUserIDFilter returns a filter function that filters payloads by user ID.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL