-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modify credential #10
base: main
Are you sure you want to change the base?
Conversation
@@ -26,15 +26,33 @@ type Options struct { | |||
Timeout int | |||
IdleConn int | |||
CompressType string | |||
Credentials Credentials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
兼容性:
- 保留原来的 Credentials,并将其标记为废弃,并注释说明如果设置了 Cred 会覆盖 Credentials
- 新增 Cred 字段
} | ||
|
||
type Credentials struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
兼容性:Credentials 保留,并标记为废弃,建议使用新的 Credential interface
} | ||
|
||
type Credentials struct { | ||
type Credential interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
命名习惯:可以去掉 Get 前缀
type Credential interface {
SecretId() string
SecretKey() string
Token() string
}
GetToken() string | ||
} | ||
|
||
type DefaultCredential struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可见性:感觉没必要导出
type credential struct {
secretID string
secretKEY string
secretToken string
}
func (c credential) SecretId() string {
return c.secretID
}
func (c credential) SecretKey() string {
return c.secretKEY
}
func (c credential) Token() string {
return c.secretToken
}
No description provided.