infrastructure

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultGormConfig

func GetDefaultGormConfig() *gorm.Config

GetDefaultGormConfig get default config.

func GetS3Config

func GetS3Config(l *logger.Logger, id, secret, token, region, endpoint string, isMinio bool) *aws.Config

GetS3Config get config.

func GetS3ConfigNoCredentials

func GetS3ConfigNoCredentials(l *logger.Logger, region, endpoint string, isMinio bool) *aws.Config

GetS3ConfigNoCredentials get no credentials config. If AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are environment variables and are in the execution environment, Credentials is not required.

func GetS3DefaultOptions added in v0.0.18

func GetS3DefaultOptions() *session.Options

GetS3DefaultOptions retrieves the options that enable SharedConfigState. Basically, Options assumes that an IAM role has been assigned in the execution environment.

func GetSESConfig

func GetSESConfig(l *logger.Logger, id, secret, token, region, endpoint string) *aws.Config

GetSESConfig get config.

func GetSESConfigNoCredentials

func GetSESConfigNoCredentials(l *logger.Logger, region, endpoint string) *aws.Config

GetSESConfigNoCredentials get no credentials config. If AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are environment variables and are in the execution environment, Credentials is not required.

func NewDownloader added in v0.0.18

func NewDownloader(s *session.Session) *s3manager.Downloader

NewDownloader returns Downloader.

func NewMySQL

func NewMySQL(c *MySQLConfig, gc *gorm.Config) *gorm.DB

NewMySQL returns an gorm db instance.

func NewPostgres

func NewPostgres(c *PostgresConfig, gc *gorm.Config) *gorm.DB

NewPostgres returns an gorm db instance.

func NewRedis added in v0.0.18

func NewRedis(o *redis.Options) *redis.Client

NewRedis returns redis client.

func NewS3

func NewS3(o *session.Options, c *aws.Config) *s3.S3

NewS3 returns S3.

func NewS3Session added in v0.0.18

func NewS3Session(o *session.Options) *session.Session

NewS3Session returns Session.

func NewSES

func NewSES(
	o *session.Options,
	c *aws.Config,
) *ses.SES

NewSES returns ses instance.

func NewSQLServer

func NewSQLServer(c *SQLServerConfig, gc *gorm.Config) *gorm.DB

NewSQLServer returns an gorm db instance.

func NewSlack

func NewSlack(c *SlackConfig) *slack.Client

NewSlack returns an SlackClient instance.

func NewUploader added in v0.0.18

func NewUploader(s *session.Session) *s3manager.Uploader

NewUploader returns Uploader.

Types

type DBConfig

type DBConfig struct {
	// ConnMaxLifetime sets max life time(sec)
	ConnMaxLifetime time.Duration
	// ConnMaxIdletime sets max idle time(sec)
	ConnMaxIdletime time.Duration
	// MaxIdleConns sets idle connection
	MaxIdleConns int
	// MaxOpenConns sets max connection
	MaxOpenConns int
}

DBConfig set configurations.

type MySQLConfig

type MySQLConfig struct {
	Config *mysql.Config
	DBConfig
}

MySQLConfig sets configurations.

type PostgresConfig

type PostgresConfig struct {
	Config *postgres.Config
	DBConfig
}

PostgresConfig sets configurations.

type SQLServerConfig

type SQLServerConfig struct {
	Config *sqlserver.Config
	DBConfig
}

SQLServerConfig sets configurations.

type SlackConfig

type SlackConfig struct {
	OauthAccessToken string
}

SlackConfig sets configurations.

Jump to

Keyboard shortcuts

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