composer

package
v0.0.0-...-ed06f05 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package composer contains the code to compose 3rd library client. It used by many cmd package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeDB

func ComposeDB(c *DB) (*gorm.DB, error)

func ComposeRedis

func ComposeRedis(r *Redis) *goredis.Client

func ComposeS3

func ComposeS3(c *S3) (*s3.S3, error)

Types

type DB

type DB struct {
	// Dialect is the database dialect, support sqlite, mysql, postgres.
	Dialect     string `mapstructure:"dialect" yaml:"dialect"`
	DSN         string `mapstructure:"dsn" yaml:"dsn"`
	TablePrefix string `mapstructure:"table_prefix" yaml:"table_prefix"`
}

type Redis

type Redis struct {
	Addr            string        `mapstructure:"addr" yaml:"addr"`
	Username        string        `mapstructure:"username" yaml:"username"`
	Password        string        `mapstructure:"password" yaml:"password"`
	DB              int           `mapstructure:"db" yaml:"db"`
	MaxRetries      int           `mapstructure:"max_retries" yaml:"max_retries"`
	MinRetryBackoff time.Duration `mapstructure:"min_retry_backoff" yaml:"min_retry_backoff"`
	MaxRetryBackoff time.Duration `mapstructure:"max_retry_backoff" yaml:"max_retry_backoff"`
	DialTimeout     time.Duration `mapstructure:"dial_timeout" yaml:"dial_timeout"`
	ReadTimeout     time.Duration `mapstructure:"read_timeout" yaml:"read_timeout"`
	WriteTimeout    time.Duration `mapstructure:"write_timeout" yaml:"write_timeout"`
	PoolFIFO        bool          `mapstructure:"pool_fifo" yaml:"pool_fifo"`
	PoolSize        int           `mapstructure:"pool_size" yaml:"pool_size"`
	PoolTimeout     time.Duration `mapstructure:"pool_timeout" yaml:"pool_timeout"`
	MinIdleConns    int           `mapstructure:"min_idle_conns" yaml:"min_idle_conns"`
	MaxIdleConns    int           `mapstructure:"max_idle_conns" yaml:"max_idle_conns"`
	MaxActiveConns  int           `mapstructure:"max_active_conns" yaml:"max_active_conns"`
	ConnMaxIdleTime time.Duration `mapstructure:"conn_max_idle_time" yaml:"conn_max_idle_time"`
	ConnMaxLifetime time.Duration `mapstructure:"conn_max_lifetime" yaml:"conn_max_lifetime"`
}

type S3

type S3 struct {
	Endpoint         string `mapstructure:"endpoint" yaml:"endpoint"`
	Region           string `mapstructure:"region" yaml:"region"`
	S3ForcePathStyle bool   `mapstructure:"s3_force_path_style" yaml:"s3_force_path_style"`
	AccessKeyID      string `mapstructure:"access_key_id" yaml:"access_key_id"`
	SecretAccessKey  string `mapstructure:"secret_access_key" yaml:"secret_access_key"`
}

Jump to

Keyboard shortcuts

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