Documentation ¶
Index ¶
- type Config
- type DBConfig
- type GCSConfig
- type Kothak
- func (k *Kothak) CloseAll() error
- func (k *Kothak) GetObjectStorage(objStorageName string) (*objectstorage.Storage, error)
- func (k *Kothak) GetRedis(redisname string) (redis.Redis, error)
- func (k *Kothak) GetSQLDB(dbname string) (*sqldb.DB, error)
- func (k *Kothak) MustGetObjectStorage(objStorageName string) *objectstorage.Storage
- func (k *Kothak) MustGetRedis(redisname string) redis.Redis
- func (k *Kothak) MustGetSQLDB(dbname string) *sqldb.DB
- type ObjectStorageConfig
- type Redis
- type RedisConfig
- type RedisConnConfig
- type S3Config
- type SQLDBConfig
- type SQLDBConnectionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { DBConfig DBConfig `json:"database" yaml:"database" toml:"database"` RedisConfig RedisConfig `json:"redis" yaml:"redis" toml:"redis"` ObjectStorageConfig []ObjectStorageConfig `json:"object_storage" yaml:"object_storage" toml:"object_storage"` }
Config of kothak
type DBConfig ¶
type DBConfig struct { MaxRetry int `json:"max_retry" yaml:"max_retry" toml:"max_retry" default:"1"` MaxOpenConnections int `json:"max_open_conns" yaml:"max_open_conns" toml:"max_open_conns" default:"10"` MaxIdleConnections int `json:"max_idle_conns" yaml:"max_idle_conns" toml:"max_idle_conns" default:"2"` ConnectionMaxLifetime string `json:"conn_max_lifetime" yaml:"conn_max_lifetime" toml:"conn_max_lifetime" default:"30s"` SQLDBs []SQLDBConfig `json:"connect" yaml:"connect" toml:"connect"` // contains filtered or unexported fields }
DBConfig define sql databases configuration
type GCSConfig ¶
type GCSConfig struct { ClientID string `json:"client_id" yaml:"client_id" toml:"client_id"` ClientSecret string `json:"client_secret" yaml:"client_secret" toml:"client_secret"` JSONKey string `json:"json_key" yaml:"json_key" toml:"json_key"` }
GCSConfig for google cloud storage
type Kothak ¶
type Kothak struct {
// contains filtered or unexported fields
}
Kothak struct
func (*Kothak) CloseAll ¶
CloseAll to close all connected resources TODO: check error when closing connections and close connection concurrently
func (*Kothak) GetObjectStorage ¶
func (k *Kothak) GetObjectStorage(objStorageName string) (*objectstorage.Storage, error)
GetObjectStorage from kothak object
func (*Kothak) MustGetObjectStorage ¶
func (k *Kothak) MustGetObjectStorage(objStorageName string) *objectstorage.Storage
MustGetObjectStorage from kothak object
func (*Kothak) MustGetRedis ¶
MustGetRedis from kothak object
type ObjectStorageConfig ¶
type ObjectStorageConfig struct { Name string `json:"name" yaml:"name" toml:"name"` Provider string `json:"provider" yaml:"provider" toml:"provider"` Region string `json:"region" yaml:"region" toml:"region"` Endpoint string `json:"endpoint" yaml:"endpoint" toml:"endpoint"` Bucket string `json:"bucket" yaml:"bucket" toml:"bucket"` BucketProto string `json:"bucket_proto" yaml:"bucket_proto" toml:"bucket_proto"` BucketURL string `json:"bucket_url" yaml:"bucket_url" toml:"bucket_url"` S3 S3Config `json:"s3" yaml:"s3" toml:"s3"` GCS GCSConfig `json:"gcs" yaml:"gcs" toml:"gcs"` }
ObjectStorageConfig struct
type RedisConfig ¶
type RedisConfig struct { MaxIdle int `json:"max_idle_conn" yaml:"max_idle_conn" toml:"max_idle_conn"` MaxActive int `json:"max_active_conn" yaml:"max_active_conn" toml:"max_active_conn"` Timeout int `json:"timeout" yaml:"timeout" toml:"timeout"` Rds []RedisConnConfig `json:"connect" yaml:"connect" toml:"connect"` }
RedisConfig of kothak
type RedisConnConfig ¶
type RedisConnConfig struct { Name string `json:"name" yaml:"name" toml:"name"` Address string `json:"address" yaml:"address" toml:"address"` MaxIdle int `json:"max_idle_conn" yaml:"max_idle_conn" toml:"max_idle_conn"` MaxActive int `json:"max_active_conn" yaml:"max_active_conn" toml:"max_active_conn"` Timeout int `json:"timeout" yaml:"timeout" toml:"timeout"` }
RedisConnConfig struct
type S3Config ¶
type S3Config struct { ClientID string `json:"client_id" yaml:"client_id" toml:"client_id"` ClientSecret string `json:"client_secret" yaml:"client_secret" toml:"client_secret"` DisableSSL bool `json:"disable_ssl" yaml:"disable_ssl" toml:"disable_ssl"` ForcePathStyle bool `json:"force_path_style" yaml:"force_path_style" toml:"force_path_style"` }
S3Config for s3 storage
type SQLDBConfig ¶
type SQLDBConfig struct { Name string `yaml:"name" toml:"name"` Driver string `yaml:"driver" toml:"driver"` LeaderConnConfig SQLDBConnectionConfig `yaml:"leader" toml:"leader"` ReplicaConnConfig SQLDBConnectionConfig `yaml:"replica" toml:"replica"` }
SQLDBConfig of kothak
type SQLDBConnectionConfig ¶
type SQLDBConnectionConfig struct { DSN string `json:"dsn" yaml:"dsn" toml:"dsn" protected:"1"` MaxOpenConnections int `json:"max_open_conns" yaml:"max_open_conns" toml:"max_open_conns"` MaxIdleConnections int `json:"max_idle_conns" yaml:"max_idle_conns" toml:"max_idle_conns"` ConnectionMaxLifetime string `json:"conn_max_lifetime" yaml:"conn_max_lifetime" toml:"conn_max_lifetime"` MaxRetry int `json:"max_retry" yaml:"max_retry" toml:"max_retry"` // contains filtered or unexported fields }
SQLDBConnectionConfig struct
func (*SQLDBConnectionConfig) SetDefault ¶
func (connConfig *SQLDBConnectionConfig) SetDefault(dbconfig DBConfig) error
SetDefault configuration
Click to show internal directories.
Click to hide internal directories.