Documentation
¶
Index ¶
- Constants
- func CheckPassword(password string, hashedPassword string) error
- func DownloadFile(client *resty.Client, url, dst string) error
- func DownloadFiles(urls []string, dstDir string) error
- func ExtractFileNames(content string) []string
- func HashPassword(password string) (string, error)
- func IsSupportedCurrency(currency string) bool
- func ListFiles(dirPath string) ([]string, error)
- func RandUserID() uuid.UUID
- func RandomContext() string
- func RandomCurrency() string
- func RandomEmail() string
- func RandomInt(min, max int64) int64
- func RandomMoney() int64
- func RandomOwner() string
- func RandomString(n int) string
- func RandomSummary() string
- func RandomTitle() string
- type Config
Constants ¶
View Source
const ( RMB = "RMB" USD = "USD" EUR = "EUR" CAD = "CAD" )
View Source
const ( Visitor = "visitor" Admin = "admin" )
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
CheckPassword checks if the provided password is correct or not
func DownloadFile ¶
DownloadFile 从 URL 下载文件并保存到本地
func DownloadFiles ¶
DownloadFiles 批量下载文件并保存到指定目录
func ExtractFileNames ¶
func HashPassword ¶
HashPassword returns the bcrypt hash of the password
func IsSupportedCurrency ¶
func RandUserID ¶
func RandomContext ¶
func RandomContext() string
func RandomString ¶
RandomString generates a random string of length n
func RandomSummary ¶
func RandomSummary() string
func RandomTitle ¶
func RandomTitle() string
Types ¶
type Config ¶
type Config struct {
Environment string `mapstructure:"ENVIRONMENT"`
AllowedOrigins []string `mapstructure:"ALLOWED_ORIGINS"`
DBDriver string `mapstructure:"DB_DRIVER"`
DBUser string `mapstructure:"DB_USER"`
DBPassword string `mapstructure:"DB_PASSWORD"`
DBSource string `mapstructure:"DB_SOURCE"`
MigrationURL string `mapstructure:"MIGRATION_URL"`
ResourcePath string `mapstructure:"RESOURCE_PATH"`
Domain string `mapstructure:"DOMAIN"`
RedisAddress string `mapstructure:"REDIS_ADDRESS"`
HTTPServerAddress string `mapstructure:"HTTP_SERVER_ADDRESS"`
GrpcGatewayAddress string `mapstructure:"GRPC_GATEWAY_ADDRESS"`
GRPCServerAddress string `mapstructure:"GRPC_SERVER_ADDRESS"`
TokenSymmetricKey string `mapstructure:"TOKEN_SYMMETRIC_KEY"`
AccessTokenDuration time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`
EmailSenderName string `mapstructure:"EMAIL_SENDER_NAME"`
EmailSenderAddress string `mapstructure:"EMAIL_SENDER_ADDRESS"`
EmailSenderPassword string `mapstructure:"EMAIL_SENDER_PASSWORD"`
UploadFileSizeLimit int64 `mapstructure:"UPLOAD_FILE_SIZE_LIMIT"`
UploadFileAllowedMime []string `mapstructure:"UPLOAD_FILE_ALLOWED_MIME"`
HTTPProxyAddr string `mapstructure:"HTTP_PROXY_ADDR"`
DefaultUserID string `mapstructure:"DEFAULT_USER_ID"`
DefaultUsername string `mapstructure:"DEFAULT_USERNAME"`
DefaultUserPassword string `mapstructure:"DEFAULT_USER_PASSWORD"`
DefaultUserFullname string `mapstructure:"DEFAULT_USER_FULLNAME"`
DefaultUserEmail string `mapstructure:"DEFAULT_USER_EMAIL"`
}
func LoadConfig ¶
Click to show internal directories.
Click to hide internal directories.