options.go 462 B

12345678910111213141516171819202122232425262728293031323334
  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. const (
  12. DataSourceTypeDatabase = "database"
  13. )
  14. type DataSourceOption struct {
  15. Name string
  16. Type string
  17. Spec map[string]any
  18. }
  19. type Options struct {
  20. // 必传
  21. token string
  22. baseUrl string
  23. namespace string
  24. dataSource *DataSourceOption
  25. // 选传
  26. timeout time.Duration
  27. }