Created
January 10, 2021 15:09
-
-
Save sunho/05af9f0d57fdbde0bf499b3c8c67d2a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PicServiceConfig struct { | |
BucketName string `yaml:"bucket_name"` | |
} | |
type PicService struct { | |
S3Service *S3Service `dim:"on"` // 여기로 서비스 인스턴스가 주입됩니다. | |
bucket string | |
} | |
func (p *PicService) Init(conf dim.ServiceConfig) error { | |
conf2 := conf.(*PicServiceConfig) | |
p.bucket = conf2.BucketName | |
return nil | |
} | |
func (PicService) DefaultConfig() dim.ServiceConfig { | |
return &PicServiceConfig { | |
BucketName: "picture", | |
} | |
} | |
func (PicService) ConfigName() string { | |
return "picservice" | |
} | |
func (p *PicService) SavePic(buf []byte) { | |
p.S3Service.Store(p.bucket, buf) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment