Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

oscarxqu
Copy link

No description provided.

@@ -26,15 +26,33 @@ type Options struct {
Timeout int
IdleConn int
CompressType string
Credentials Credentials

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 {

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 {

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 {

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants