s3

package
v0.0.0-...-4a8097e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2018 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package s3 is used to implement model.IM interface. Its purpose is controlling images of users and ads.

s3 uses AWS simple storage service to store images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Bucket string `json:"Bucket"`
	ACL    string `json:"ACL"`
	Region string `json:"Region"`
}

Config is config for AWS S3 image manager

type S3

type S3 struct {
	// contains filtered or unexported fields
}

S3 is a struct that implements model.IM interface

func InitS3

func InitS3(cfg Config) (*S3, error)

InitS3 initiates connection to S3

func (*S3) DeleteImage

func (s *S3) DeleteImage(key string) error

DeleteImage deletes such key from the bucket

func (*S3) DownloadImage

func (s *S3) DownloadImage(key string) error

DownloadImage downloads image from AWS

func (*S3) IsExist

func (s *S3) IsExist(key string) bool

IsExist checks if such key exists in the bucket

func (*S3) UploadImage

func (s *S3) UploadImage(key string, body io.Reader) (string, error)

UploadImage uploads body as key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL