store

package
v0.0.0-...-c2121da Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2018 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownQuoteFormat 未知的Quote格式
	ErrUnknownQuoteFormat = errors.New("未知的Quote格式")
)

Functions

This section is empty.

Types

type AliyunOSS

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

AliyunOSS 阿里云对象存储服务

func NewAliyunOSS

func NewAliyunOSS(config AliyunOSSConfig) *AliyunOSS

NewAliyunOSS 新建阿里云对象存储服务

func (AliyunOSS) Exists

func (s AliyunOSS) Exists(_market market.Market, date time.Time) (bool, error)

Exists 判断是否存在

func (AliyunOSS) Load

func (s AliyunOSS) Load(_market market.Market, date time.Time) (market.DailyQuote, error)

Load 读取

func (AliyunOSS) Save

func (s AliyunOSS) Save(quote market.DailyQuote) error

Save 保存

type AliyunOSSConfig

type AliyunOSSConfig struct {
	EndPoint        string `yaml:"endpoint"` // Key
	AccessKeyID     string `yaml:"id"`       // ID
	AccessKeySecret string `yaml:"secret"`   // Key
	Bucket          string `yaml:"bucket"`   // Bucket
	KeyRoot         string `yaml:"root"`     // Root
}

AliyunOSSConfig 阿里云对象存储服务配置

type AmazonS3

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

AmazonS3 亚马逊S3存储服务

func NewAmazonS3

func NewAmazonS3(s3config AmazonS3Config) AmazonS3

NewAmazonS3 亚马逊S3存储服务

func (AmazonS3) Exists

func (s AmazonS3) Exists(_market market.Market, date time.Time) (bool, error)

Exists 判断某天的数据是否存在

func (AmazonS3) Load

func (s AmazonS3) Load(_market market.Market, date time.Time) (market.DailyQuote, error)

Load 读取

func (AmazonS3) Save

func (s AmazonS3) Save(quote market.DailyQuote) error

Save 保存

type AmazonS3Config

type AmazonS3Config struct {
	AccessKeyID     string `yaml:"id"`      // ID
	SecretAccessKey string `yaml:"secret"`  // Key
	Region          string `yaml:"region"`  // 区域
	Bucket          string `yaml:"bucket"`  // 存储桶
	KeyRoot         string `yaml:"keyroot"` // S3路径根目录
}

AmazonS3Config 亚马逊S3存储配置

type FileSystem

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

FileSystem 文件系统存储服务

func NewFileSystem

func NewFileSystem(config FileSystemConfig) *FileSystem

NewFileSystem 新建文件系统存储服务

func (FileSystem) Exists

func (s FileSystem) Exists(_market market.Market, date time.Time) (bool, error)

Exists 判断是否存在

func (FileSystem) Load

func (s FileSystem) Load(_market market.Market, date time.Time) (market.DailyQuote, error)

Load 读取

func (FileSystem) Save

func (s FileSystem) Save(quote market.DailyQuote) error

Save 保存

type FileSystemConfig

type FileSystemConfig struct {
	StoreRoot string // 存储根目录
}

FileSystemConfig 文件系统配置

type Redis

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

Redis Redis存储

func NewRedis

func NewRedis(config RedisConfig) *Redis

NewRedis 新建Redis存储

func (Redis) Exists

func (s Redis) Exists(_market market.Market, date time.Time) (bool, error)

Exists 判断是否存在

func (Redis) Load

func (s Redis) Load(_market market.Market, date time.Time) (market.DailyQuote, error)

Load 读取

func (Redis) Save

func (s Redis) Save(quote market.DailyQuote) error

Save 保存

type RedisConfig

type RedisConfig struct {
	Options redis.Options
}

RedisConfig Redis存储配置

type Store

type Store interface {
	// 判断是否记录过
	Exists(_market market.Market, date time.Time) (bool, error)
	// 保存
	Save(quote market.DailyQuote) error
	// 读取
	Load(_market market.Market, date time.Time) (market.DailyQuote, error)
}

Store 存储

Jump to

Keyboard shortcuts

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