options.go 583 B

1234567891011121314151617181920212223242526
  1. package rediswatcher
  2. import (
  3. "github.com/google/uuid"
  4. "github.com/redis/go-redis/v9"
  5. )
  6. type WatcherOptions struct {
  7. Options redis.Options
  8. ClusterOptions redis.ClusterOptions
  9. SubClient *redis.Client
  10. PubClient *redis.Client
  11. Channel string
  12. IgnoreSelf bool
  13. LocalID string
  14. OptionalUpdateCallback func(string)
  15. }
  16. func initConfig(option *WatcherOptions) {
  17. if option.LocalID == "" {
  18. option.LocalID = uuid.New().String()
  19. }
  20. if option.Channel == "" {
  21. option.Channel = "/casbin"
  22. }
  23. }