data_store

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package data_store - Will move this to central repo, temporarily is copy pasted everywhere

Index

Constants

View Source
const (
	ESDefaultTimeout = time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cassandra

type Cassandra struct {
	Keyspace          string   `mapstructure:"keyspace"`
	Hosts             []string `mapstructure:"hosts"`
	Timeout           int      `mapstructure:"timeout"`
	ReconnectInterval int      `mapstructure:"reconnect_interval"`
	Port              int      `mapstructure:"port"`
	ProtoVersion      int      `mapstructure:"proto_version"`
	// contains filtered or unexported fields
}

func (*Cassandra) Cluster

func (ds *Cassandra) Cluster() *gocql.ClusterConfig

func (*Cassandra) Init

func (ds *Cassandra) Init() error

func (*Cassandra) LoadFromConfig

func (ds *Cassandra) LoadFromConfig(key string, config *viper.Viper) error

func (*Cassandra) Session

func (ds *Cassandra) Session() *gocql.Session

type ElasticSearch

type ElasticSearch struct {
	Hosts   []string      `mapstructure:"hosts"`
	Timeout time.Duration `mapstructure:"timeout"`
	ApiKey  string        `mapstructure:"api_key"`
	// contains filtered or unexported fields
}

func (*ElasticSearch) Client

func (ds *ElasticSearch) Client() *elasticsearch.Client

func (*ElasticSearch) LoadFromConfig

func (ds *ElasticSearch) LoadFromConfig(key string, config *viper.Viper) error

type Gcs added in v0.2.5

type Gcs struct {
	BaseUrl         string `mapstructure:"base_url"`
	BucketName      string `mapstructure:"bucket_name"`
	CredentialsFile string `mapstructure:"credentials_file"`
}

func (*Gcs) Bucket added in v0.2.5

func (gcs *Gcs) Bucket() (*storage.BucketHandle, *storage.Client, error)

bucket

func (*Gcs) Client added in v0.2.5

func (gcs *Gcs) Client() (*storage.Client, error)

client

func (*Gcs) LoadFromConfig added in v0.2.5

func (gcs *Gcs) LoadFromConfig(key string, config *viper.Viper) error

type Gorm added in v0.1.2

type Gorm struct {
	User                 string `mapstructure:"user"`
	Password             string `mapstructure:"password"`
	Net                  string `mapstructure:"net"`
	Addr                 string `mapstructure:"addr"`
	DBName               string `mapstructure:"db_name"`
	Charset              string `mapstructure:"charset"`
	AllowNativePasswords bool   `mapstructure:"allow_native_passwords"`
	Debug                bool   `mapstructure:"debug"`
	Driver               string `mapstructure:"driver"`
	Timeout              int    `mapstructure:"timeout"`
	ReadTimeout          int    `mapstructure:"read_timeout"`
	WriteTimeout         int    `mapstructure:"write_timeout"`
}

func (*Gorm) Db added in v0.1.2

func (ds *Gorm) Db() (*gorm.DB, error)

func (*Gorm) LoadFromConfig added in v0.1.2

func (ds *Gorm) LoadFromConfig(key string, config *viper.Viper) error

type Kafka

type Kafka struct {
	Hosts           []string `mapstructure:"hosts"`
	Topic           string   `mapstructure:"topic"`
	MaxMessageBytes int      `mapstructure:"max_message_bytes"`
	Username        string   `mapstructure:"username"`
	Password        string   `mapstructure:"password"`
	IsSASL          bool     `mapstructure:"is_sasl"`
	// contains filtered or unexported fields
}

func (*Kafka) LoadFromConfig

func (ds *Kafka) LoadFromConfig(key string, config *viper.Viper) error

func (*Kafka) Producer

func (ds *Kafka) Producer() sarama.AsyncProducer

type MongoDB added in v0.2.4

type MongoDB struct {
	DbName     string   `mapstructure:"db_name"`
	Collection string   `mapstructure:"collection"`
	UserName   string   `mapstructure:"user_name"`
	Password   string   `mapstructure:"password"`
	Host       string   `mapstructure:"host"`
	Replicas   []string `mapstructure:"replicas"`
	ReplicaSet string   `mapstructure:"replica_set"`
	// contains filtered or unexported fields
}

func (*MongoDB) Dispose added in v0.2.4

func (ds *MongoDB) Dispose()

func (*MongoDB) Instance added in v0.2.4

func (ds *MongoDB) Instance() *mongo.Client

func (*MongoDB) LoadFromConfig added in v0.2.4

func (ds *MongoDB) LoadFromConfig(key string, config *viper.Viper) error

type Mysql

type Mysql struct {
	User                 string `mapstructure:"user"`
	Password             string `mapstructure:"password"`
	Net                  string `mapstructure:"net"`
	Addr                 string `mapstructure:"addr"`
	DBName               string `mapstructure:"db_name"`
	AllowNativePasswords bool   `mapstructure:"allow_native_passwords"`
	Timeout              int    `json:"timeout"`
	ReadTimeout          int    `json:"read_timeout"`
	WriteTimeout         int    `json:"write_timeout"`
	MaxOpenConns         int    `json:"max_open_conns"`
	MaxIdleConns         int    `json:"max_idle_conns"`
	ConnMaxLifetime      int    `json:"conn_max_lifetime"`
	// contains filtered or unexported fields
}

func (*Mysql) Db

func (ds *Mysql) Db() *sql.DB

func (*Mysql) LoadFromConfig

func (ds *Mysql) LoadFromConfig(key string, config *viper.Viper) error

type Postgres

type Postgres struct {
}

func (*Postgres) LoadFromConfig

func (ds *Postgres) LoadFromConfig(key string, config *viper.Viper) error

type Redis

type Redis struct {
	Addr        string `mapstructure:"addr"`
	Password    string `mapstructure:"password"`
	DB          int    `mapstructure:"db"`
	ReadTimeout int    `mapstructure:"readtimeout"`
	Channel     string `mapstructure:"channel"`
	// contains filtered or unexported fields
}

func (*Redis) Client

func (ds *Redis) Client() *redis.Client

func (*Redis) LoadFromConfig

func (ds *Redis) LoadFromConfig(key string, config *viper.Viper) error

type RedisCluster added in v0.1.3

type RedisCluster struct {
	MasterName string   `mapstructure:"name"`
	Addr       []string `mapstructure:"addr"`
	//Username   string   `mapstructure:"username"`
	Password string `mapstructure:"password"`
	// contains filtered or unexported fields
}

RedisCluster @todo: Merge with redis

func (*RedisCluster) Client added in v0.1.3

func (ds *RedisCluster) Client() *redis.ClusterClient

func (*RedisCluster) LoadFromConfig added in v0.1.3

func (ds *RedisCluster) LoadFromConfig(key string, config *viper.Viper) error

type RedisSentinel

type RedisSentinel struct {
	MasterName string   `mapstructure:"name"`
	Addr       []string `mapstructure:"addr"`
	//Username   string   `mapstructure:"username"`
	Password string `mapstructure:"password"`
	// contains filtered or unexported fields
}

RedisSentinel @todo: Merge with redis

func (*RedisSentinel) Client

func (ds *RedisSentinel) Client() *redis.Client

func (*RedisSentinel) LoadFromConfig

func (ds *RedisSentinel) LoadFromConfig(key string, config *viper.Viper) error

type Solr added in v0.2.5

type Solr struct {
	Scheme string `mapstructure:"scheme"`
	Host   string `mapstructure:"host"`
	Port   string `mapstructure:"port"`
	Client *solr.JSONClient
}

func (*Solr) LoadFromConfig added in v0.2.5

func (ds *Solr) LoadFromConfig(key string, config *viper.Viper) error

Jump to

Keyboard shortcuts

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