Documentation ¶
Index ¶
- Constants
- func GetFieldTagMap(d interface{}, tagIdentifier string) map[string]string
- func GetFieldValue(d interface{}, field string) interface{}
- func GetTagValueMap(d interface{}, tagIdentifier string) map[string]string
- func Output(w http.ResponseWriter, jsonData []byte, httpStatus int)
- type ApiRequest
- type ApiResponse
- type CouchbaseConfig
- type CouchbaseDB
- type RDBMS
- func (d *RDBMS) Close() error
- func (d *RDBMS) Connect() error
- func (d *RDBMS) ConnectM2() error
- func (d *RDBMS) DropTable(tableName string) error
- func (d *RDBMS) InsertRow(table string, insertDataArray map[string]string) int
- func (d *RDBMS) SelectRows(tableName, columns, condition, limit, offset, orderBy string) *sql.Rows
- func (d *RDBMS) UpdateRows(table string, updateDataArray map[string]string, ...) *sql.Rows
- func (d *RDBMS) UpdateTable(table string, updateDataArray map[string]string, ...) (sql.Result, error)
- type RDBMSConfig
- type Utils
- func (u *Utils) CPUCores() int32
- func (u *Utils) CPUInfo() ([]cpu.InfoStat, error)
- func (u *Utils) DeleteFileByAge(path string, minAgeForDeletion int64) (bool, error)
- func (u *Utils) DeleteFileList(fileExtToClean, directoryPath string) int
- func (u *Utils) DeleteFileListE(prefix, fileExtToClean, directoryPath string, maxAge int64, forceNoExt bool) int
- func (u *Utils) DeleteMessage(qURL string, svc *sqs.SQS, receiptHandler *string) error
- func (u *Utils) EnqueueSQS(arrayDataJSON string, qURL string, dbM2 *RDBMS, dbM2Err error) (int, int)
- func (u *Utils) EnqueueSQSBatch(arrayDataJSON string, qURL string, dbM2 *RDBMS, dbM2Err error) (int, int)
- func (u *Utils) EnqueueSQSImport(qMsgs []schemas.QueueMessageDatum, qURL string, dbProd *sql.DB, dbM2 *RDBMS, ...)
- func (u *Utils) ExitErrorf(msg string, args ...interface{})
- func (u *Utils) FileExists(path string) bool
- func (u *Utils) GetAWSSession() (*session.Session, error)
- func (u *Utils) GetFileList(directoryPath string) map[int]string
- func (u *Utils) GetFileListGlob(pattern string) map[int]string
- func (u *Utils) ImplodeMapIntString(glue string, pieces map[int]string) string
- func (u *Utils) ImplodeStringArr(glue string, pieces []string) string
- func (u *Utils) InsertEmailPool(email, subject, content string, dbProd *RDBMS)
- func (u *Utils) InsertEnqueueRetry(query string, qURL string, dbProd *RDBMS)
- func (u *Utils) LoadAvg() (*load.AvgStat, error)
- func (u *Utils) LoadAvgCheck() int
- func (u *Utils) LoadAvgCheckCPUCores(cpuCores int32) int
- func (u *Utils) MicroTime() float64
- func (u *Utils) NewUUID() string
- func (u *Utils) ReceiveMessageSQS(sess *session.Session, maxMsgs, qURL string) (*sqs.SQS, *sqs.ReceiveMessageOutput, error)
- func (u *Utils) RenderTemplate(res http.ResponseWriter, templateType string, templateName string, ...)
- func (u *Utils) SendCurl(query string, url string) (result *http.Response)
- func (u *Utils) SendEmailAlert(emails []string, subject, emailContent string)
- func (u *Utils) SendRequest(p *ApiRequest, myChan chan ApiResponse, result ApiResponse)
- func (u *Utils) UploadToS3(bucket string, key string, source string) (*s3manager.UploadOutput, error)
Constants ¶
const ( CPU_CORES_CPUINFO_ERROR = -2 LAVG_TREND_CPUINFO_ERROR = -1 SUCCEEDED = 0 LAVG_TREND_ERROR = 1 LAVG_TREND_INCREASING = 2 LAVG_TREND_NORMAL = 3 FILE_EXT_ERR = 4 FILE_EXT_NOT_PROVIDED = 5 FILE_EXT_ASTERISK = 6 FILE_PREFIX_ERR = 8 FILE_PREFIX_ASTERISK = 9 DB_CONN_ERR = 10 DB_USERNAME_NOT_PROVIDED = 11 DB_NAME_NOT_PROVIDED = 12 DB_HOSTNAME_NOT_PROVIDED = 14 LAVG_LOAD_LEVEL_YELLOW = 70 DEL_FILE_LIST_E_SLEEP = 60 GITHUB_WEBHOOK_SERVER_PORT_DEFAULT = 8990 )
Variables ¶
This section is empty.
Functions ¶
func GetFieldTagMap ¶
func GetFieldValue ¶
func GetFieldValue(d interface{}, field string) interface{}
func GetTagValueMap ¶
Types ¶
type ApiRequest ¶
type ApiRequest struct { Log *log.Logger Url string `json:"url"` Data string `json:"data"` Headers map[string]string `json:"headers"` Async bool `json:"async"` Timeout int `json:"timeout"` RequestMethod string `json:"request_method"` ScheduledTimeStamp int32 `json:"scheduled_time_stamp"` DataFormat string `json:"data_format"` ExtraInformation string `json:"extra_information"` AmazonTraceId string `json:"amzn_trace_id"` }
func (*ApiRequest) AsyncSend ¶
func (p *ApiRequest) AsyncSend() ApiResponse
func (*ApiRequest) CallApi ¶
func (p *ApiRequest) CallApi(responseResult ApiResponse) ApiResponse
func (*ApiRequest) Send ¶
func (p *ApiRequest) Send() ApiResponse
type ApiResponse ¶
type CouchbaseConfig ¶
type CouchbaseConfig struct { HostName string // Hostname of the SQL server Port int64 // Port number of the SQL server UserName string // Username part of the SQL server credentials Password string // Password for the a fore-defined UserName Bucket string // bucket to open BucketPass string // bucket to open }
func (*CouchbaseConfig) String ¶
func (c *CouchbaseConfig) String() string
func (*CouchbaseConfig) URL ¶
func (c *CouchbaseConfig) URL() string
type CouchbaseDB ¶
func (*CouchbaseDB) Connect ¶
func (c *CouchbaseDB) Connect() error
func (*CouchbaseDB) OpenBucket ¶
func (c *CouchbaseDB) OpenBucket() (*gocb.Bucket, error)
func (*CouchbaseDB) Upsert ¶
func (c *CouchbaseDB) Upsert(key string, value ApiResponse) error
type RDBMS ¶
type RDBMS struct { Conn *sql.DB ConnErr error Conf *RDBMSConfig }
func (*RDBMS) InsertRow ¶
*
- @param type string $dbObj
- @param type string $tablename
- @param type string insertDataArray
- @return type int
- @author Shweta<shweta.agarwal@healthians.com>
func (*RDBMS) SelectRows ¶
*
- @param type string $dbObj
- @param type string $tablename
- @param type string $columns
- @param type string $condition
- @param type integer $limit
- @param type integer $offset
- @param type string $order_by
- @return array
- @author Shweta <shweta.agarwal@healthians.com>
func (*RDBMS) UpdateRows ¶
func (d *RDBMS) UpdateRows(table string, updateDataArray map[string]string, optionDataArray map[string]string) *sql.Rows
*
- @param type string $dbObj
- @param type string $tablename
- @param type string updateDataArray
- @param type string optionDataArray
- @return type rows
- @author Shweta<shweta.agarwal@healthians.com>
type RDBMSConfig ¶
type RDBMSConfig struct { DriverName string // Name of the SQL driver viz., mysql, postgres, sqlite etc HostName string // Hostname of the SQL server Port int64 // Port number of the SQL server Database string // Name of the database to connect to on the SQL server UserName string // Username part of the SQL server credentials Password string // Password for the afore-defined UserName MaxOpenConns int // Maximum number of connections to be opened MaxIdleConns int // Maximum number of idle connections to be kept MaxLifeTimeConn int // Maximum life of connection (in seconds) }
func (*RDBMSConfig) DSN ¶
func (c *RDBMSConfig) DSN() string
func (*RDBMSConfig) String ¶
func (c *RDBMSConfig) String() string
type Utils ¶
func (*Utils) DeleteFileByAge ¶
func (*Utils) DeleteFileList ¶
func (*Utils) DeleteFileListE ¶
func (*Utils) DeleteMessage ¶
DeleteMessage - Delete a message from queue
func (*Utils) EnqueueSQS ¶
func (u *Utils) EnqueueSQS(arrayDataJSON string, qURL string, dbM2 *RDBMS, dbM2Err error) (int, int)
EnqueueSQS - Add data to queue
func (*Utils) EnqueueSQSBatch ¶
func (u *Utils) EnqueueSQSBatch(arrayDataJSON string, qURL string, dbM2 *RDBMS, dbM2Err error) (int, int)
EnqueueSQSBatch - Add data to queue in batches of 10 messages
func (*Utils) EnqueueSQSImport ¶
func (u *Utils) EnqueueSQSImport(qMsgs []schemas.QueueMessageDatum, qURL string, dbProd *sql.DB, dbM2 *RDBMS, dbM2Err error)
EnqueueSQSImport - Add Slice data to queue
func (*Utils) ExitErrorf ¶
ExitErrorf - A function to output error and kill the current process returning the control back to the OS.
func (*Utils) FileExists ¶
func (*Utils) GetAWSSession ¶
GetAWSSession - returns an active AWS session for further use with the components of the AWS SDK
and error in case it is not able to create one.
func (*Utils) ImplodeMapIntString ¶
func (*Utils) ImplodeStringArr ¶
func (*Utils) InsertEmailPool ¶
InsertEmailPool - insert a row into email_pool
func (*Utils) InsertEnqueueRetry ¶
InsertEnqueueRetry - A function to insert data into the redrive queue
func (*Utils) LoadAvgCheck ¶
func (*Utils) LoadAvgCheckCPUCores ¶
func (*Utils) ReceiveMessageSQS ¶
func (*Utils) RenderTemplate ¶
func (u *Utils) RenderTemplate(res http.ResponseWriter, templateType string, templateName string, data interface{})
RenderTemplate serves HTML template
func (*Utils) SendEmailAlert ¶
func (*Utils) SendRequest ¶
func (u *Utils) SendRequest(p *ApiRequest, myChan chan ApiResponse, result ApiResponse)
func (*Utils) UploadToS3 ¶
func (u *Utils) UploadToS3(bucket string, key string, source string) (*s3manager.UploadOutput, error)
UploadToS3 - Function to upload a file to AWS' Simple Storage Service (S3) bucket - string containing the bucket name key - string containing the key under which the data is to be stored source - string containing the path of local file that is to be uploaded Cf. https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/s3-example-basic-bucket-operations.html