bootstrap

package
v0.0.0-...-d00b715 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitCronRankJob

func InitCronRankJob(rankJob *RankJob) *cron.Cron

func NewAliyunClient

func NewAliyunClient(env *Env) *sms.Client

func NewCron

func NewCron(timeout time.Duration, postRankUsecase *usecase.PostRankUsecase) *cron.Cron

NewCron

func NewDoubaoChat

func NewDoubaoChat() chat.Chat

func NewLocalCache

func NewLocalCache(env *Env) *cache.RistrettoCache

func NewMinio

func NewMinio() file.FileStorage

func NewOrmDatabase

func NewOrmDatabase(env *Env) orm.Database

func NewProducer

func NewProducer(env *Env) event.Producer

func NewRedisCache

func NewRedisCache(env *Env) *cache.RedisCache

func NewSaramaClient

func NewSaramaClient(env *Env) sarama.Client

Types

type Application

type Application struct {
	Env *Env
	//Mongo mongo.Client
	Orm        orm.Database
	Cache      *cache.RedisCache
	LocalCache *cache.RistrettoCache

	Producer event.Producer

	SaramaClient sarama.Client

	SMSAliyunClient *sms.Client

	MinioClient file.FileStorage

	DoubaoChat chat.Chat
}

func App

func App() Application

type CronRankJob

type CronRankJob struct {
	// contains filtered or unexported fields
}

func NewCronRankJob

func NewCronRankJob(job *RankJob) *CronRankJob

func (*CronRankJob) Run

func (c *CronRankJob) Run()

type Env

type Env struct {
	AppEnv         string `mapstructure:"APP_ENV"`
	ServerAddr     string `mapstructure:"SERVER_ADDR"`
	ContextTimeout int    `mapstructure:"CONTEXT_TIMEOUT"`

	AccessTokenExpiryHour  int    `mapstructure:"ACCESS_TOKEN_EXPIRY_HOUR"`
	RefreshTokenExpiryHour int    `mapstructure:"REFRESH_TOKEN_EXPIRY_HOUR"`
	AccessTokenSecret      string `mapstructure:"ACCESS_TOKEN_SECRET"`
	RefreshTokenSecret     string `mapstructure:"REFRESH_TOKEN_SECRET"`

	RateLimit       int `mapstructure:"RATE_LIMIT"`
	RateLimitWindow int `mapstructure:"RATE_LIMIT_WINDOW"`

	SnowflakeStartTime string `mapstructure:"SNOWFLAKE_START_TIME"`
	SnowflakeMachineID int64  `mapstructure:"SNOWFLAKE_MACHINE_ID"`

	LocalStaticPath string `mapstructure:"LOCAL_STATIC_PATH"`
	UrlStaticPath   string `mapstructure:"URL_STATIC_PATH"`

	OpenIMServerDoamin string `mapstructure:"OPENIM_SERVER_DOMAIN"`

	SMSAppID      string `mapstructure:"SMS_APP_ID"`
	SMSSignName   string `mapstructure:"SMS_SIGN_NAME"`
	SMSTemplateID string `mapstructure:"SMS_TEMPLATE_ID"`
	SMSEndpoint   string `mapstructure:"SMS_ENDPOINT"`
	SMSRegionId   string `mapstructure:"SMS_REGION_ID"`

	MySQLHost     string `mapstructure:"MYSQL_HOST"`
	MySQLPORT     string `mapstructure:"MYSQL_PORT"`
	MySQLUsername string `mapstructure:"MYSQL_USERNAME"`
	MySQLPassword string `mapstructure:"MYSQL_PASSWORD"`
	MySQLDB       string `mapstructure:"MYSQL_DB"`

	RedisHost       string `mapstructure:"REDIS_HOST"`
	RedisPort       string `mapstructure:"REDIS_PORT"`
	RedisExpiration int    `mapstructure:"REDIS_EXPIRATION"`
	RedisPassword   string `mapstructure:"REDIS_PASSWORD"`
	RedisDB         int    `mapstructure:"REDIS_DB"`

	KafkaAddr      string `mapstructure:"KAFKA_ADDR"`
	PrometheusAddr string `mapstructure:"PROMETHEUS_ADDR"`
}

func NewEnv

func NewEnv() *Env

type Job

type Job interface {
	Name() string
	Run() error
}

type RankJob

type RankJob struct {
	// contains filtered or unexported fields
}

func NewRankJob

func NewRankJob(rankUsecase domain.RankUsecase, timeout time.Duration) *RankJob

func (*RankJob) Name

func (j *RankJob) Name() string

func (*RankJob) Run

func (j *RankJob) Run() error

Jump to

Keyboard shortcuts

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