Versions in this module Expand all Collapse all v0 v0.0.3 Apr 24, 2020 v0.0.2 Apr 23, 2020 Changes in this version + type App struct + DBList []*DBClient + Name string + Server *Server + WorkerList []*Worker + func NewApp(name string) *App + func (app *App) Launch() error + func (app *App) OnAllDBConnected(task Task) + func (app *App) SetupAPIServer() (*Server, error) + func (app *App) SetupDBClient(config DBConfiguration) *DBClient + func (app *App) SetupWorker() *Worker + type Worker struct + Task Task + func (worker *Worker) Execute() + func (worker *Worker) SetDelay(seconds int) *Worker + func (worker *Worker) SetRepeatPeriod(seconds int) *Worker + func (worker *Worker) SetTask(fn Task) *Worker v0.0.1 Apr 20, 2020 Changes in this version + const None + var APIMethod = MethodEnum + var APIStatus = &StatusEnum + var DbStatus = &DbStatusEnum + var HTTPMethods = &HTTPMethodEnum + type APIClientConfiguration struct + Address string + LoggingCol string + MaxConnection int + MaxRetry int + Protocol string + Timeout time.Duration + WaitToRetry time.Duration + type APIResponse struct + Data interface{} + ErrorCode string + Headers map[string]string + Message string + Status string + Total int64 + type AppWorker struct + Task Task + func (worker *AppWorker) Execute() + func (worker *AppWorker) SetDelay(seconds int) *AppWorker + func (worker *AppWorker) SetRepeatPeriod(seconds int) *AppWorker + func (worker *AppWorker) SetTask(fn Task) *AppWorker + type CallResult struct + ErrorLog *string + RespBody *string + RespCode int + RespHeader map[string][]string + ResponseTime int64 + type ConsumeFn = func(*QueueItem) error + type DBClient struct + Config DBConfiguration + Name string + func (client *DBClient) Connect() error + func (client *DBClient) OnConnected(fn OnConnectedHandler) + type DBConfiguration struct + Address []string + AuthDB string + Password string + ReplicaSetName string + SecondaryPreferred bool + Ssl bool + Username string + type DBModel struct + ColName string + DBName string + TemplateObject interface{} + func (m *DBModel) Aggregate(pipeline interface{}, result interface{}) error + func (m *DBModel) Count(query interface{}) *DbResponse + func (m *DBModel) Create(entity interface{}) *DbResponse + func (m *DBModel) CreateIndex(index mgo.Index) error + func (m *DBModel) CreateMany(entityList ...interface{}) *DbResponse + func (m *DBModel) Delete(selector interface{}) *DbResponse + func (m *DBModel) GetColWith(s *DBSession) (*mgo.Collection, error) + func (m *DBModel) GetFreshSession() *DBSession + func (m *DBModel) IncreOne(query interface{}, fieldName string, value int) *DbResponse + func (m *DBModel) Init(s *DBSession) error + func (m *DBModel) NewList(limit int) interface{} + func (m *DBModel) NewObject() interface{} + func (m *DBModel) Query(query interface{}, offset int, limit int, reverse bool) *DbResponse + func (m *DBModel) QueryOne(query interface{}) *DbResponse + func (m *DBModel) QueryS(query interface{}, offset int, limit int, sortStr string) *DbResponse + func (m *DBModel) Update(query interface{}, updater interface{}) *DbResponse + func (m *DBModel) UpdateOne(query interface{}, updater interface{}) *DbResponse + func (m *DBModel) UpsertOne(query interface{}, updater interface{}) *DbResponse + type DBQueue2 struct + ColName string + func (dbq *DBQueue2) Init(mSession *DBSession, dbName string) + func (dbq *DBQueue2) InitWithExpiredTime(mSession *DBSession, dbName string, expiredTime time.Duration) + func (dbq *DBQueue2) Push(data interface{}) error + func (dbq *DBQueue2) PushWithKey(data interface{}, keys *[]string) error + func (dbq *DBQueue2) StartConsumer(consumer ConsumeFn, channelNum int) + type DBQueueChannel struct + type DBQueueConnector struct + type DBSession struct + func (s *DBSession) Clone() *DBSession + func (s *DBSession) Close() + func (s *DBSession) Copy() *DBSession + func (s *DBSession) GetMGOSession() *mgo.Session + func (s *DBSession) Valid() bool + type DbResponse struct + Data interface{} + ErrorCode string + Message string + Status string + Total int64 + type DbStatusEnum struct + Error string + NotFound string + Ok string + type Error struct + Data interface{} + Message string + Type string + func (e *Error) Error() string + type HTTPMethod string + type HTTPMethodEnum struct + Delete HTTPMethod + Get HTTPMethod + Head HTTPMethod + Option HTTPMethod + Post HTTPMethod + Put HTTPMethod + type HandleFunc func(request Request) Response + type IPoll interface + Add func(conn net.Conn) error + Remove func(conn net.Conn) error + Wait func(int64) ([]net.Conn, error) + type KQueue struct + func NewKQueue() *KQueue + func (k *KQueue) Add(wsConn net.Conn) error + func (k *KQueue) Remove(wsConn net.Conn) error + func (k *KQueue) Wait(timeout int64) ([]net.Conn, error) + type LCache struct + func NewLCache(maxItem int, ttl int) (m *LCache) + func NewLCacheRefreshMode(maxItem int, ttl int, refreshTTL bool) (m *LCache) + func (c *LCache) Cleanup() + func (c *LCache) ContainsKey(k string) (ok bool) + func (c *LCache) Get(k string) (v interface{}, ok bool) + func (c *LCache) Len() int + func (c *LCache) Put(k string, v interface{}) + func (c *LCache) Remove(k string) + type MethodEnum struct + DELETE *MethodValue + GET *MethodValue + OPTIONS *MethodValue + POST *MethodValue + PUT *MethodValue + type MethodValue struct + Value string + type OnConnectedHandler = func(session *DBSession) error + type OutboundAPIRequest struct + Content string + Headers map[string]string + Method string + Params map[string]string + Path string + func NewOutboundAPIRequest(method string, path string, params map[string]string, content string, ...) *OutboundAPIRequest + func (req *OutboundAPIRequest) GetContent(data interface{}) error + func (req *OutboundAPIRequest) GetContentText() string + func (req *OutboundAPIRequest) GetHeaders() map[string]string + func (req *OutboundAPIRequest) GetIP() string + func (req *OutboundAPIRequest) GetMethod() *MethodValue + func (req *OutboundAPIRequest) GetParams() map[string]string + func (req *OutboundAPIRequest) GetPath() string + type QueueItem struct + CreatedTime *time.Time + Data interface{} + ID *bson.ObjectId + Keys *[]string + LastFail *time.Time + LastUpdatedTime *time.Time + Log *[]string + ProcessBy string + ProcessTimeMS int + Version string + type Request struct + Action string + Data interface{} + type RequestLogEntry struct + Date *time.Time + ErrorLog *string + Keys *[]string + ReqBody *interface{} + ReqFormData *map[string]string + ReqHeader *map[string]string + ReqMethod string + ReqURL string + Results []*CallResult + RetryCount int + Status string + TotalTime int64 + type Response struct + Data interface{} + Message string + Status string + type RestClient struct + BaseURL *url.URL + UserAgent string + func NewHTTPClient(config *APIClientConfiguration) *RestClient + func NewRESTClient(baseURL string, logName string, timeout time.Duration, maxRetryTime int, ...) *RestClient + func (c *RestClient) MakeHTTPRequest(method HTTPMethod, headers map[string]string, params map[string]string, ...) (*RestResult, error) + func (c *RestClient) MakeHTTPRequestWithKey(method HTTPMethod, headers map[string]string, params map[string]string, ...) (*RestResult, error) + func (c *RestClient) MakeRequest(req OutboundAPIRequest) *APIResponse + func (c *RestClient) SetDBLog(dbName string, session *DBSession) + func (c *RestClient) SetDebug(val bool) + func (c *RestClient) SetLoggerName(loggerName string) + func (c *RestClient) SetMaxRetryTime(maxRetryTime int) + func (c *RestClient) SetTimeout(timeout time.Duration) + func (c *RestClient) SetWaitTime(waitTime time.Duration) + type RestResult struct + Body string + Code int + Content []byte + type Server struct + Poll IPoll + PollTimeout int64 + func NewServer(kqTimeout int64) *Server + func (s *Server) GetHandler(path string) HandleFunc + func (s *Server) Process(conn net.Conn) + func (s *Server) SetHandle(path string, handler HandleFunc) + func (s *Server) Start() + type StatusEnum struct + Error string + Existed string + Forbidden string + Invalid string + NotFound string + Ok string + Unauthorized string + type Task = func()