func New(config ...Config) Storage
func (s *Storage) Get(key string) ([]byte, error)
func (s *Storage) Set(key string, val []byte, exp time.Duration) error
func (s *Storage) Delete(key string) error
func (s *Storage) Reset() error
func (s *Storage) Close() error
func (s *Storage) Conn() azblob.Client
go mod init github.com/<user>/<repo>
go get github.com/gofiber/storage/azureblob/v2
storage 패키지를 가져옵니다.
import "github.com/gofiber/storage/azureblob/v2"
// 기본 config 초기화
store := azureblob.New()
// 커스텀 config 초기화
store := azureblob.New(azureblob.Config{
Account: "test",
Container: "test",
Credentials: Credentials{
Account: "test",
Key: "YXp1cml0ZWtleQo=",
},
})
type Config struct {
// Storage 계정명.
Account string
// 컨테이너명.
Container string
// Storage endpoint.
// 선택사항. 기본값: "https://STORAGEACCOUNTNAME.blob.core.windows.net"
Endpoint string
// 요청 타임아웃.
// 선택사항. 기본값은 0(타임아웃 없음)
RequestTimeout time.Duration
// Reset은 기존 컨테이너의 모든 키를 삭제합니다.
// 선택사항. 기본값은 false
Reset bool
// Credentials는 AWS access key와 AWS secret access key를 오버라이드합니다. 비추천.
// 선택사항. 기본값은 Credentials{}
Credentials Credentials
// 실패한 재시도 가능한 요청의 최대 시도 횟수.
// 선택사항. 기본값은 3
MaxAttempts int
}
var ConfigDefault = Config{
Account: "",
Container: "",
Endpoint: "",
RequestTimeout: 0,
Reset: false,
MaxAttempts: 3,
}