common

package
v0.0.0-...-27145f1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeResponse

func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error

func GetEnv

func GetEnv(env, fallback string) string

func MakeError

func MakeError(w http.ResponseWriter, code int, domain string, message string, method string)

Types

type BackupReader

type BackupReader interface {
	Reader(ctx context.Context, path string) (io.ReadCloser, error)
}

type BackupSave

type BackupSave interface {
	Save(ctx context.Context, fileName string, reader io.Reader) (path string, err error)
}

type BackupStorage

type BackupStorage interface {
	BackupSave
	BackupReader
}

func NewBackupStorage

func NewBackupStorage(storage *BucketStorage) BackupStorage

type BucketConfig

type BucketConfig struct {
	ConnectionString string
	AccessID         string
	AccessKey        string
}

type BucketStorage

type BucketStorage struct {
	Bucket *blob.Bucket
}

func NewBucketStorage

func NewBucketStorage(config BucketConfig) *BucketStorage

func NewGCPBucketStorage

func NewGCPBucketStorage(config BucketConfig) *BucketStorage

TODO redo this to pass in variables

func (*BucketStorage) Get

func (s *BucketStorage) Get(ctx context.Context, path string) (string, error)

func (*BucketStorage) List

func (s *BucketStorage) List(ctx context.Context) <-chan string

func (*BucketStorage) Reader

func (s *BucketStorage) Reader(ctx context.Context, path string) (io.ReadCloser, error)

func (*BucketStorage) Save

func (s *BucketStorage) Save(ctx context.Context, fileName string, reader io.Reader) (path string, err error)

type Config

type Config struct {
	DatabaseType           string
	PostgresConfig         PostgresDatabaseConfig
	BucketConnectionConfig BucketConfig
}

func LoadConfig

func LoadConfig() Config

func (*Config) LoadBucketConfig

func (c *Config) LoadBucketConfig() BucketConfig

func (*Config) LoadPostgresDatabaseConfig

func (c *Config) LoadPostgresDatabaseConfig() PostgresDatabaseConfig

type DocumentGet

type DocumentGet interface {
	Get(ctx context.Context, path string) (string, error)
	List(ctx context.Context) <-chan string
}

type DocumentSave

type DocumentSave interface {
	Save(ctx context.Context, fileName string, reader io.Reader) (path string, err error)
}

type DocumentStorage

type DocumentStorage interface {
	DocumentSave
	DocumentGet
}

func NewBucketDocumentStorage

func NewBucketDocumentStorage(storage *BucketStorage) DocumentStorage

type PostgresDatabaseConfig

type PostgresDatabaseConfig struct {
	ConnectionString string
}

Jump to

Keyboard shortcuts

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