storage

package
v0.0.0-...-bcdc212 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MySQLStorageProviderName = "mysql"
	MySQLTimeFormat          = "2006-01-02 15:04:05"
)
View Source
const MongoDBProviderName = "mongodb"

Variables

View Source
var ErrNotEnoughBytesInGenerator = errors.New("id generator must return byte slice with 16 bytes in it")
View Source
var (
	ErrStorageNotFound = errors.New("storage is not found")
)

Functions

func NewMongoStorage

func NewMongoStorage(c MongoDBConfig) (currencyFetcher.Storage, error)

func NewMySQLStorage

func NewMySQLStorage(c MySQLConfig) (currencyFetcher.Storage, error)

func NewStorage

func NewStorage(provider Provider, config interface{}) (currencyFetcher.Storage, error)

Types

type BaseConfig

type BaseConfig struct {
	Cxt     context.Context
	Migrate bool
}

type IDGenerator

type IDGenerator interface {
	Generate() []byte
}

type MongoDBConfig

type MongoDBConfig struct {
	BaseConfig
	ConnectionString string
	Database         string
	Collection       string
}

type MySQLConfig

type MySQLConfig struct {
	BaseConfig
	ConnectionString string
	TableName        string
	IDGenerator      IDGenerator
}

type Provider

type Provider string
const (
	MySQL   Provider = "mysql"
	MongoDB Provider = "mongodb"
)

func ConvertToProviderFromString

func ConvertToProviderFromString(str string) (Provider, error)

func ConvertToProvidersFromStringSlice

func ConvertToProvidersFromStringSlice(strings []string) ([]Provider, error)

Jump to

Keyboard shortcuts

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