db

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClickHouseClient

func NewClickHouseClient(cfg ClickhouseConfig) (*sql.DB, error)

func NewPostgresClient

func NewPostgresClient(cfg PostgresConfig) (*gorm.DB, error)

func NewRedisClient

func NewRedisClient(cfg RedisConfig) (*redis.Client, error)

Types

type AWSConfig

type AWSConfig struct {
	AccessKeyID     string `mapstructure:"access_key_id"`
	SecretAccessKey string `mapstructure:"secret_access_key"`
	Bucket          string `mapstructure:"bucket"`
	Region          string `mapstructure:"region"`
	// Used for minio as local aws
	Local    bool   `mapstructure:"local"`
	Endpoint string `mapstructure:"endpoint"`
}

type ClickhouseConfig

type ClickhouseConfig struct {
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	DBName   string `mapstructure:"database"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Debug    bool   `mapstructure:"debug"`
}

type MongoClient

type MongoClient struct {
	Client   *mongo.Client
	Database *mongo.Database
}

func NewMongoClient

func NewMongoClient(cfg MongoDBConfig) (*MongoClient, error)

func (*MongoClient) Disconnect

func (c *MongoClient) Disconnect()

Disconnect from mongodb If error occur on disconnection nothing happen

type MongoDBConfig

type MongoDBConfig struct {
	AppName   string `mapstructure:"app_name"`
	Host      string `mapstructure:"host"`
	Port      string `mapstructure:"port"`
	Username  string `mapstructure:"username"`
	Password  string `mapstructure:"password"`
	AuthDB    string `mapstructure:"auth_db"`
	UseDBName string `mapstructure:"database"`
}

type PostgresConfig

type PostgresConfig struct {
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	DBName   string `mapstructure:"database"`
}

type RedisConfig

type RedisConfig struct {
	Host string `mapstructure:"host"`
	Port int    `mapstructure:"port"`
	DB   int    `mapstructure:"db"`
}

type S3ClientAWS

type S3ClientAWS struct {
	Session *session.Session
	S3      *s3.S3
	Bucket  string
}

func NewS3ClientAWS

func NewS3ClientAWS(cfg AWSConfig) (*S3ClientAWS, error)

Directories

Path Synopsis
For generate mocks on sarama interfaces
For generate mocks on sarama interfaces

Jump to

Keyboard shortcuts

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