options.go 515 B

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