options.go 346 B

12345678910111213141516171819202122232425
  1. package sdk
  2. import (
  3. "time"
  4. )
  5. type Option func(opts *Options)
  6. func WithTimeout(timeout time.Duration) Option {
  7. return func(opts *Options) {
  8. opts.timeout = timeout
  9. }
  10. }
  11. type Options struct {
  12. // 必传
  13. token string
  14. baseUrl string
  15. grpcAddress string
  16. namespace string
  17. dataSource string
  18. // 选传
  19. timeout time.Duration
  20. }