Skip to content

Commit

Permalink
fix: sms interface name changed from Sms to SmsService
Browse files Browse the repository at this point in the history
  • Loading branch information
alilestera committed Oct 12, 2023
1 parent 2525c81 commit 2e61dc3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions components/sms/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@ import (

type Registry interface {
Register(fs ...*Factory)
Create(compType string) (Sms, error)
Create(compType string) (SmsService, error)
}

type Factory struct {
CompType string
FactoryMethod func() Sms
FactoryMethod func() SmsService
}

func NewFactory(compType string, f func() Sms) *Factory {
func NewFactory(compType string, f func() SmsService) *Factory {
return &Factory{
CompType: compType,
FactoryMethod: f,
}
}

type registry struct {
stores map[string]func() Sms
stores map[string]func() SmsService
info *info.RuntimeInfo
}

func NewRegistry(info *info.RuntimeInfo) Registry {
info.AddService(serviceName)
return &registry{
stores: make(map[string]func() Sms),
stores: make(map[string]func() SmsService),
info: info,
}
}
Expand All @@ -56,7 +56,7 @@ func (r *registry) Register(fs ...*Factory) {
}
}

func (r *registry) Create(compType string) (Sms, error) {
func (r *registry) Create(compType string) (SmsService, error) {
if f, ok := r.stores[compType]; ok {
r.info.LoadComponent(serviceName, compType)
return f(), nil
Expand Down
2 changes: 1 addition & 1 deletion components/sms/sms.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
serviceName = "sms"
)

type Sms interface {
type SmsService interface {
Init(context.Context, *Config) error

SendSmsWithTemplate(context.Context, *SendSmsWithTemplateRequest) (*SendSmsWithTemplateResponse, error)
Expand Down
2 changes: 1 addition & 1 deletion components/sms/tencentcloud/sms.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ type Sms struct {
}

// NewSms create empty sms client for tencentcloud
func NewSms() sms.Sms {
func NewSms() sms.SmsService {
return &Sms{}
}

Expand Down

0 comments on commit 2e61dc3

Please sign in to comment.