Documentation ¶
Index ¶
- Constants
- Variables
- func BatchSet(k string, data interface{}, c redis.Conn) error
- func CacheGetAllKey(dataname string) []string
- func CacheSetDataPlus(dataname string, dataField string) int
- func Catchs()
- func CheckKey(k string, c redis.Conn) bool
- func DelFile(fileList []string)
- func DelKey(k string, c redis.Conn) error
- func DianZhan(tablename, channelStr, docid string, userid int, c redis.Conn) int
- func FileExists(path string) bool
- func GetCurDate() string
- func GetCurTime() string
- func GetDB() *gorm.DB
- func GetDianZhan(tablename, channelStr, docid string, userid int, c redis.Conn) int
- func GetInt(k string) (int, error)
- func GetJsonByte(k string) ([]byte, error)
- func GetKeyFromRedisByLabel(tabelname string, label string) string
- func GetKeyTTL(k string) int
- func GetRandomString(l int) string
- func GetTZHTime(hours time.Duration) string
- func HDEL(k string, filed interface{}, c redis.Conn) error
- func HGETALL(k string) ([]interface{}, error)
- func HMGet(k string, filed interface{}, c redis.Conn) (interface{}, error)
- func HMGetPojo(k string, filed interface{}, pojo DBPojo, c redis.Conn) error
- func HMHINCRBY(k string, filed interface{}, incre int) error
- func HMSet(k string, filed interface{}, value interface{}, c redis.Conn) error
- func HTTPGet(urlpath string, query url.Values) (result map[string]interface{}, err error)
- func HTTPPost(url string, requestBody string) (map[string]interface{}, error)
- func HVALS(k string, c redis.Conn) ([]string, error)
- func InitConfig(path string)
- func InitDB() (err error)
- func InitRedis() error
- func InitStatisticsLog()
- func IsLetter(chars rune) bool
- func LBatchpush(k string, data interface{}, c redis.Conn) error
- func LREM(k string, count int, value interface{}) (err error)
- func LSET(k string, index int, value string) error
- func LTRIM(k string, start, stop int) (err error)
- func LocalTimeToUTC(strTime string) time.Time
- func LoggerToFile() gin.HandlerFunc
- func Lpush(k string, data interface{}) error
- func LpushString(k string, data string) (count int, err error)
- func Lrange(k string, start, end int) ([]int, error)
- func LrangeString(k string, start, end int) ([]string, error)
- func NewRedisPool(redisURL, pswd string, db int) (redisErr error)
- func PlusBatchOne(k string, c redis.Conn) int
- func PraseTimeInt(stringTime string) int64
- func PraseTimeTint(tsStr string) int64
- func ReadAll(filePth string) ([]byte, error)
- func RedisClose(c redis.Conn)
- func RedisGet(k string, c redis.Conn) ([]byte, error)
- func RedisOpen() redis.Conn
- func Rpush(k string, data int) error
- func RpushString(k string, data string) (count int, err error)
- func Rrange(k string, start, end int) ([]int, error)
- func SADD(k string, fileID int) error
- func SADDString(k string, value string) error
- func SMEMBERS(k string) (interface{}, error)
- func Set(k string, data interface{}) error
- func SetKeyExpire(k string, ex int, c redis.Conn)
- func SetKeyWithExpire(k string, data interface{}, ex int, c redis.Conn) error
- func StatisticsLog(sd *StatisticsData) error
- func StringsToJSON(str string) string
- func TimeConverStr(ts, oldLayout, newLayout string) string
- func TimeStrToInt(ts, layout string) int64
- func TimeTConverStr(ts string) string
- func ZADD(key string, score int, value interface{}, c redis.Conn) error
- type AuthingConfig
- type BuildParam
- type BuildServer
- type Config
- type DBPojo
- type DatabaseConfig
- type JsonData
- type JwtConfig
- type K8sConfig
- type PkgList
- type RedisConfig
- type Statistic
- type StatisticsData
- type WSConfig
Constants ¶
View Source
const ( //CodeStatusError for server error CodeStatusServerError int = 500 //CodeStatusNormal for client error CodeStatusClientError int = 400 //CodeStatusNormal normal statu CodeStatusNormal int = 200 )
View Source
const DATE_FORMAT = "2006-01-02 15:04:05"
View Source
const DATE_T_FORMAT = "2006-01-02T15:04:05"
View Source
const DATE_T_Z_FORMAT = "2006-01-02T15:04:05Z"
View Source
const DT_FORMAT = "2006-01-02"
View Source
const (
//----------------------------------
RedisNotFoundItem = "redisNotFoundItem"
)
Variables ¶
View Source
var CnTime *time.Location
View Source
var GlobK8sConfig *rest.Config
View Source
var Log *logrus.Logger
View Source
var SLog *logrus.Logger
statistics log
Functions ¶
func CacheGetAllKey ¶
CacheGetAllKey 获取一个cache中的所有field
func CacheSetDataPlus ¶
CacheSetDataPlus 缓存一些数据,每隔一段时间再更新数据库,避免db较大压力
func FileExists ¶
func GetCurDate ¶
func GetCurDate() string
func GetCurTime ¶
func GetCurTime() string
func GetDianZhan ¶
GetDianZhan 查看某个作品是否已经点赞
func GetKeyFromRedisByLabel ¶
GetKeyFromRedisByLabel 根据名称获取它在redis里面的Key标签
func GetRandomString ¶
func GetTZHTime ¶
func InitConfig ¶
func InitConfig(path string)
func InitStatisticsLog ¶
func InitStatisticsLog()
func LocalTimeToUTC ¶
func LoggerToFile ¶
func LoggerToFile() gin.HandlerFunc
func LpushString ¶
LpushString 插入多个Object
func LrangeString ¶
LrangeString 从左边获取多个
func NewRedisPool ¶
NewRedisPool return redis pool
func PraseTimeTint ¶
func RpushString ¶
RpushString 插入多个Object
func SetKeyWithExpire ¶
func StatisticsLog ¶
func StatisticsLog(sd *StatisticsData) error
func TimeConverStr ¶
func TimeStrToInt ¶
func TimeTConverStr ¶
Types ¶
type AuthingConfig ¶
type AuthingConfig struct { UserPoolID string `json:"userPoolID"` Secret string `json:"secret"` AppID string `json:"appID"` AppSecret string `json:"appSecret"` RedirectURI string `json:"redirect_uri"` }
Authing Config
type BuildParam ¶
type BuildServer ¶
type BuildServer struct { ApiUrl string `json:"apiUrl"` OmniRepoAPI string `json:"omniRepoAPI"` OmniRepoAPIInternal string `json:"omniRepoAPIInternal"` }
Build Server
type Config ¶
type Config struct { AppName string `json:"app_name"` AppModel string `json:"app_model"` AppHost string `json:"app_host"` AppPort int `json:"app_port"` Database DatabaseConfig `json:"database"` RedisConfig RedisConfig `json:"redis_config"` BuildParam BuildParam `json:"buildParam"` DefaultPkgList PkgList CustomPkgList PkgList WSConfig WSConfig `json:"ws_config"` K8sConfig K8sConfig `json:"k8s"` AuthingConfig AuthingConfig `json:"authing"` JwtConfig JwtConfig `json:"jwt"` BuildServer BuildServer `json:"buildServer"` Statistic Statistic `json:"statistic"` }
app config
type DatabaseConfig ¶
type DatabaseConfig struct { Driver string `json:"driver"` DBUser string `json:"db_user"` Password string `json:"password"` DBHost string `json:"db_host"` DBPort string `json:"db_port"` DbName string `json:"db_name"` Chartset string `json:"charset"` ShowSql bool `json:"show_sql"` }
sql config
type JsonData ¶
type JsonData struct { Code int `json:"code"` Title interface{} `json:"title"` Attach interface{} `json:"attach,omitempty"` Data interface{} `json:"data"` Other interface{} `json:"other,omitempty"` }
JsonData export to clent
func ExportData ¶
ExportData ExportData
type RedisConfig ¶
type RedisConfig struct { Addr string `json:"addr"` Port string `json:"port"` Password string `json:"password"` Db int `json:"db"` }
Redis config
type Statistic ¶
type Statistic struct { Dir string `json:"dir"` LogFile string `json:"log_file"` LogFileSize int64 `json:"log_file_size"` LogFileSuffix string `json:"log_file_suffix"` }
Statistic function
type StatisticsData ¶
Click to show internal directories.
Click to hide internal directories.