Go Fiber 한글 공식 문서
  • 🙇‍♀️안녕하세요
  • 🏠Home
    • 👋Welcome
    • 📁API
      • 📦Fiber
      • 🚀App
      • 🧠Ctx
      • 📋Constants
      • 🌎Client
      • 📃Log
      • 🧬Middleware
        • Adaptor
        • BasicAuth
        • Cache
        • Compress
        • CORS
        • CSRF
        • EarlyData
        • Encrypt Cookie
        • EnvVar
        • ETag
        • ExpVar
        • Favicon
        • FileSystem
        • Health Check
        • Helmet
        • Idempotency
        • Keyauth
        • Limiter
        • Logger
        • Monitor
        • Pprof
        • Proxy
        • Recover
        • Redirect
        • RequestID
        • Rewrite
        • Session
        • Skip
        • Timeout
    • 📁Guide
      • 🔌Routing
      • 🎭Grouping
      • 📝Templates
      • 🐛Error Handling
      • 🔎Validation
      • 🎣Hooks
      • ⚡Make Fiber Faster
    • 📁Extra
      • 🤔FAQ
      • 📊Benchmarks
  • 🧩Extra
    • 🧬Contrip
      • 👋Welcome
      • Casbin
      • Fgprof
      • Fiberi18n
      • Fibernewrelic
      • Fibersentry
      • Fiberzap
      • Fiberzerolog
      • JWT
      • LoadShed
      • Opafiber
      • Otelfiber
        • Example
      • Paseto
      • README
      • Swagger
      • Websocket
    • 📦Storage
      • 👋Welcome
      • ArangoDB
      • Azure Blob
      • Badger
      • Bbolt
      • Coherence
      • Couchbase
      • DynamoDB
      • Etcd
      • Memcache
      • Memory
      • Minio
      • MongoDB
      • MSSQL
      • MySQL
      • Nats
      • Pebble
      • Postgres
      • Redis
      • Ristretto
      • Rueidis
      • S3
      • ScyllaDb
      • SQLite3
    • 📃Template
      • 👋Welcome
      • Ace
      • Amber
      • Django
      • Handlebars
      • HTML
        • Golang Templates Cheatsheet
      • Jet
      • Mustache
      • Pug
      • Slim
Powered by GitBook
On this page
  • Table of Contents
  • Signatures
  • Installation
  • Examples
  • Config
  • Default Config
  1. Extra
  2. Storage

Azure Blob

PreviousArangoDBNextBadger

Last updated 1 year ago


는 클라우드를 위한 Microsoft의 객체 스토리지 솔루션입니다.

참고: Go 1.19 이상 버전이 필요합니다

Table of Contents

  • Signatures

  • Installation

  • Examples

  • Config

  • Default Config

Signatures

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

Installation

go mod init github.com/<user>/<repo>

그리고 azure blob 구현을 설치합니다:

go get github.com/gofiber/storage/azureblob/v2

Examples

storage 패키지를 가져옵니다.

import "github.com/gofiber/storage/azureblob/v2"

다음과 같은 방법으로 storage를 생성할 수 있습니다:

// 기본 config 초기화
store := azureblob.New()

// 커스텀 config 초기화
store := azureblob.New(azureblob.Config{
    Account: "test",
    Container: "test", 
    Credentials: Credentials{
        Account: "test", 
        Key: "YXp1cml0ZWtleQo=",
    },
})

Config

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
}

Default Config

var ConfigDefault = Config{
  Account:        "",
  Container:      "",
  Endpoint:       "",
  RequestTimeout: 0,
  Reset:          false,
  MaxAttempts:    3,
}

Azure blob storage 드라이버는 모듈 지원이 되는 에서 테스트되었습니다. 아직 초기화하지 않았다면 먼저 초기화해야 합니다:

🧩
📦
Go 최신 2개 버전
Azure Blob storage