Documentation ¶
Index ¶
- Constants
- func CacheJob(cache map[string]interface{}) error
- func CacheNews(path string)
- func GenerateKey(data int64, length int) string
- func GetFileList(dir string) []string
- func GetJob(id string) (map[string]string, error)
- func GetNewsCache(key string) (map[string]string, error)
- func GetPagedNews(pageNum int64, pageSize int64) ([]map[string]string, int64, error)
- func GinLogger(log *logrus.Logger) gin.HandlerFunc
- func InitDataPuller(config *Config) error
- func InitEnv(config *Config)
- func LoggerFromConfig(config *Config) *logrus.Logger
- func ParseData(data string, length int) (string, string)
- func SetNewsToCache(cache map[string]interface{}) error
- func StartServ(config *Config)
- type Common
- type Config
- type Job
- type Log
- type News
- type Redis
- type Server
Constants ¶
View Source
const (
// DefaultFormat default time format
DefaultFormat = "2006-01-02 15:04:05"
)
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
GenerateKey return string which has 0 prefix for number 25 and length equals 6 => 000025
func GetFileList ¶
GetFileList read directory path and return file list
func GetPagedNews ¶
GetPagedNews 获取新闻
func InitDataPuller ¶
InitDataPuller load data from file and save into redis dir E:/tmp/data repo https://github.com/gocn/news.git
func LoggerFromConfig ¶
LoggerFromConfig get logger by filename
func ParseData ¶
ParseData return two strings for string 202002020004 and length equals 8 => 20200202, 0004
func SetNewsToCache ¶
SetNewsToCache store data to redis
Types ¶
type Config ¶
type Config struct { Common `ini:"common"` Server `ini:"server"` Redis `ini:"redis"` Log `ini:"log"` }
Config config
func InitConfig ¶
InitConfig read config from file
type Log ¶
type Log struct { LogFilePath string `ini:"logFilePath"` LogFileName string `ini:"logFileName"` LogLevel int `ini:"logLevel"` LogOutput string `ini:"logOutput"` }
Server config
Click to show internal directories.
Click to hide internal directories.