Documentation ¶
Index ¶
- Constants
- func CloseNSQConsumer(client *nsq.Consumer)
- func CloseNSQConsumerList(clientList []*nsq.Consumer)
- func CreateConcurrentNSQConsumer(topicName, channelName string, lookupAddressList []string, ...) []*nsq.Consumer
- func CreateConsumer(cnf *std.ConfigNsqConsumer) (*nsq.Consumer, error)
- func CreateDB(config std.ConfigMysql) *gorm.DB
- func CreateDB_test(config std.ConfigMysql) *gorm.DB
- func CreateNSQConsumer(topicName, channelName string, lookupAddressList []string, ...) *nsq.Consumer
- func CreateProducer(nsqdAddress string) *nsq.Producer
- func Death(will func())
- func GO(goroutine StdGoRoutine)
- func GenerateRangeNum(min, max int) int
- func GetAppFlagFromUid(uid int64) std.AppFlag
- func GetAppTypeFromUid(uid int64) string
- func GetDBIdFromUserID(uid int64) int64
- func GetDBIdsFromUserIDs(uids []int64) []int64
- func GetUserIDFromDBId(appType string, dbId int64) int64
- func InitRedis(config std.ConfigRedis) *redis.Client
- func InitRedisRing(config ...std.ConfigRedis) *redis.Ring
- func MapToSyncMap(m map[interface{}]interface{}) *sync.Map
- func PostRequest(url string, data interface{}) ([]byte, int, error)
- func RandomDateTimeString(strlen int, stype string) string
- func SyncMapToMap(m *sync.Map) map[interface{}]interface{}
- type CassandraHelp
- type DbClient
- type DbSession
- type Logger
- type MemoPool
- type QueueWorker
- type RequestAggregator
- type SendEmail
- type SendRequest
- type StdGoRoutine
- type TimeMixin
- type WorkAction
Constants ¶
View Source
const ( CreatedAtColumn = "created_at" UpdatedAtColumn = "updated_at" )
Variables ¶
This section is empty.
Functions ¶
func CloseNSQConsumer ¶
func CloseNSQConsumer(client *nsq.Consumer)
func CloseNSQConsumerList ¶
func CloseNSQConsumerList(clientList []*nsq.Consumer)
func CreateConsumer ¶
func CreateConsumer(cnf *std.ConfigNsqConsumer) (*nsq.Consumer, error)
func CreateNSQConsumer ¶
func CreateNSQConsumer(topicName, channelName string, lookupAddressList []string, messageHandler nsq.Handler) *nsq.Consumer
TODO consumer
func CreateProducer ¶
func CreateProducer(nsqdAddress string) *nsq.Producer
func GO ¶
func GO(goroutine StdGoRoutine)
func GetAppFlagFromUid ¶
func GetAppTypeFromUid ¶
func GetDBIdFromUserID ¶
func GetDBIdsFromUserIDs ¶
func GetUserIDFromDBId ¶
func InitRedis ¶
func InitRedis(config std.ConfigRedis) *redis.Client
InitRedis initializes the redis connection. Usage: client := InitRedis(config)
func InitRedisRing ¶
func InitRedisRing(config ...std.ConfigRedis) *redis.Ring
func MapToSyncMap ¶
func RandomDateTimeString ¶
func SyncMapToMap ¶
Types ¶
type CassandraHelp ¶
type CassandraHelp struct { Session *gocql.Session ClusterConfig *gocql.ClusterConfig }
func GetCassandraHelp ¶
func GetCassandraHelp() *CassandraHelp
func InitNewCassandraHelp ¶
func InitNewCassandraHelp(config std.ConfigCassandra) *CassandraHelp
type DbClient ¶
type DbClient struct {
// contains filtered or unexported fields
}
func ConfigDatabase ¶
func ConfigDatabase(c ...std.ConfigMysql) *DbClient
type DbSession ¶
type DbSession struct {
// contains filtered or unexported fields
}
func BeginDbSession ¶
type MemoPool ¶
type MemoPool struct {
// contains filtered or unexported fields
}
func NewSimpleMemoPool ¶
func NewSimpleMemoPool() *MemoPool
func (*MemoPool) UnMemoizeAll ¶
func (mp *MemoPool) UnMemoizeAll()
type QueueWorker ¶
type QueueWorker struct {
// contains filtered or unexported fields
}
func NewQueueWorker ¶
func NewQueueWorker(workers int, onWork WorkAction) *QueueWorker
func (*QueueWorker) Enqueue ¶
func (sl *QueueWorker) Enqueue(job interface{})
func (*QueueWorker) Start ¶
func (sl *QueueWorker) Start()
func (*QueueWorker) Stop ¶
func (sl *QueueWorker) Stop()
func (*QueueWorker) Work ¶
func (sl *QueueWorker) Work(index int)
type RequestAggregator ¶
type RequestAggregator struct {
// contains filtered or unexported fields
}
func NewRequestAggregator ¶
func NewRequestAggregator(batchSize, workers int, sendRequestFunc SendRequest) *RequestAggregator
func (*RequestAggregator) Enqueue ¶
func (sa *RequestAggregator) Enqueue(req interface{})
func (*RequestAggregator) Start ¶
func (sa *RequestAggregator) Start()
func (*RequestAggregator) Stop ¶
func (sa *RequestAggregator) Stop()
type SendRequest ¶
type SendRequest func([]interface{}) error
type StdGoRoutine ¶
type StdGoRoutine interface {
Start()
}
type TimeMixin ¶
type TimeMixin struct { CreatedAt time.Time `gorm:"column:created_at;type:TIMESTAMP(6);default:CURRENT_TIMESTAMP(6);index"` UpdatedAt time.Time `gorm:"column:updated_at;type:TIMESTAMP(6);default:CURRENT_TIMESTAMP(6);index"` }
TimeMixin mixin
type WorkAction ¶
type WorkAction func(int)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.