utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

CTX is the global context for Redis

Functions

func OpenDB added in v1.0.3

func OpenDB(cfg Config) (*sql.DB, error)

func OpenMySQL added in v1.0.3

func OpenMySQL(user, password, database, host, port string) (*sql.DB, error)

OpenMySQL opens a MySQL connection with a desired user, password, database name, host, and port

func OpenPostgres added in v1.0.3

func OpenPostgres(user, password, database, host, port string) (*sql.DB, error)

OpenPostgres opens a PostgreSQL connection with a desired user, password database name, host and port

func OpenRedis added in v1.0.3

func OpenRedis(redisAddress, redisPassword string) *redis.Client

OpenRedis opens a redis connection with a desired address and password

func ValidateFilePath added in v1.0.3

func ValidateFilePath(path string) error

ValidateFilePath validates the filepath of a given file

Types

type Config added in v1.0.3

type Config struct {
	SQLType     string  `yaml:"sqltype"`
	SQLUser     string  `yaml:"sqluser"`
	SQLPassword string  `yaml:"sqlpassword"`
	SQLDatabase string  `yaml:"sqldatabase"`
	SQLHost     string  `yaml:"sqlhost"`
	SQLPort     string  `yaml:"sqlport"`
	SQLTable    string  `yaml:"sqltable"`
	RedisAddr   string  `yaml:"redisaddr"`
	RedisPass   string  `yaml:"redispass"`
	LogLevel    *uint8  `yaml:"log_level"`
	LogFilename *string `yaml:"log_filename"`
}

Config is the configuration struct for redisql

func NewConfig added in v1.0.3

func NewConfig(filePath string) (*Config, error)

NewConfig initializes a new object of Config structure

func (Config) CopyToHash added in v1.0.3

func (c Config) CopyToHash() error

CopyToHash reads a desired SQL table's rows and writes them to Redis hashes

func (Config) CopyToList added in v1.0.3

func (c Config) CopyToList() error

CopyToList reads a desired SQL table's rows and writes them to Redis lists

func (Config) CopyToString added in v1.0.3

func (c Config) CopyToString() error

CopyToString reads a desired SQL table's rows and writes them to Redis strings

type PipelineHook added in v1.0.3

type PipelineHook struct {
}

func (PipelineHook) AfterProcess added in v1.0.3

func (p PipelineHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

Required to implement a hook

func (PipelineHook) AfterProcessPipeline added in v1.0.3

func (p PipelineHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

func (PipelineHook) BeforeProcess added in v1.0.3

func (p PipelineHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

Required to implement a hook

func (PipelineHook) BeforeProcessPipeline added in v1.0.3

func (p PipelineHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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