Documentation ¶
Index ¶
- type HTTPCall
- type PanicHandlerController
- func (pc *PanicHandlerController) GetPanicAndSendToSlack(c *gin.Context, serviceName, message string) error
- func (pc *PanicHandlerController) SetPanicResp(c *gin.Context, serviceName, message string) *resources.PanicHandlerResponse
- func (pc *PanicHandlerController) SetPayloadSlack(resp *resources.PanicHandlerResponse) slack.Payload
- type PostgreSQLHandler
- func (d *PostgreSQLHandler) Begin() (interfaces.IDBTx, error)
- func (d *PostgreSQLHandler) BeginTx() (*sqlx.Tx, error)
- func (d *PostgreSQLHandler) Close()
- func (d *PostgreSQLHandler) Commit() error
- func (d *PostgreSQLHandler) ConnectDB(dbAccRead *resources.DBAccount, dbAccWrite *resources.DBAccount)
- func (d *PostgreSQLHandler) DriverName() string
- func (d *PostgreSQLHandler) Exec(query string, args ...interface{}) (sql.Result, error)
- func (d *PostgreSQLHandler) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (d *PostgreSQLHandler) Get(dest interface{}, query string, args ...interface{}) error
- func (d *PostgreSQLHandler) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (d *PostgreSQLHandler) In(query string, params ...interface{}) (string, []interface{}, error)
- func (d *PostgreSQLHandler) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (d *PostgreSQLHandler) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (d *PostgreSQLHandler) QueryRow(query string, args ...interface{}) *sql.Row
- func (d *PostgreSQLHandler) QueryRowSqlx(query string, args ...interface{}) *sqlx.Row
- func (d *PostgreSQLHandler) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
- func (d *PostgreSQLHandler) Rebind(query string) string
- func (d *PostgreSQLHandler) Rollback() error
- func (d *PostgreSQLHandler) Select(dest interface{}, query string, args ...interface{}) error
- func (d *PostgreSQLHandler) TransactionBlock(tx *sqlx.Tx, fc func(tx *sqlx.Tx) error) error
- type RedisHandler
- func (r *RedisHandler) Close()
- func (r *RedisHandler) ConnectRedis(ra *resources.RedisAccount)
- func (r *RedisHandler) CreateRedisMutex(key string, options ...redsync.Option) *redsync.Mutex
- func (r *RedisHandler) CreateRedisync() *redsync.Redsync
- func (r *RedisHandler) Del(keys ...string) error
- func (r *RedisHandler) Get(key string) (string, error)
- func (r *RedisHandler) GetSet(key string, data interface{}) error
- func (r *RedisHandler) HDel(key string, fields ...string) error
- func (r *RedisHandler) HGetAll(key string) (map[string]string, error)
- func (r *RedisHandler) HMGet(key string, fields ...string) ([]interface{}, error)
- func (r *RedisHandler) HMSet(key string, data interface{}) error
- func (r *RedisHandler) HMSetEx(key string, parameter resources.SetExParameter) error
- func (r *RedisHandler) JSONDel(key, path string) (interface{}, error)
- func (r *RedisHandler) JSONGet(key string) (interface{}, error)
- func (r *RedisHandler) JSONMGet(path string, keys ...string) (interface{}, error)
- func (r *RedisHandler) JSONSet(key string, data interface{}) (interface{}, error)
- func (r *RedisHandler) Keys(pattern string) ([]string, error)
- func (r *RedisHandler) LLen(key string) (int64, error)
- func (r *RedisHandler) LPush(key string, value ...interface{}) error
- func (r *RedisHandler) LRange(key string, start int64, stop int64) ([]string, error)
- func (r *RedisHandler) LockRedisMutex(mutex *redsync.Mutex, tries int) error
- func (r *RedisHandler) Pipeline()
- func (r *RedisHandler) SAdd(key string, data ...interface{}) error
- func (r *RedisHandler) SIsMember(key string, data interface{}) (bool, error)
- func (r *RedisHandler) SPop(key string) (string, error)
- func (r *RedisHandler) Scan(key string) ([]string, error)
- func (r *RedisHandler) Set(key string, data interface{}) error
- func (r *RedisHandler) SetEx(key string, parameter resources.SetExParameter) error
- func (r *RedisHandler) XDel(stream string, ids ...string) error
- type Slack
- type SlackWebhook
- type SlackWebhookFuncOption
- type SqlxTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPCall ¶
type HTTPCall struct { Conf *resources.SectionHTTP // contains filtered or unexported fields }
func NewHTTPCall ¶
func NewHTTPCall(conf *resources.SectionHTTP) *HTTPCall
NewHTTPCall init HTTPCall
func (*HTTPCall) CallService ¶
func (h *HTTPCall) CallService(method, url string, requestBody []byte) (string, *resources.ApplicationError)
CallService is a function to call another service
func (*HTTPCall) CallServiceByte ¶
func (h *HTTPCall) CallServiceByte(method, url string, requestBody []byte) ([]byte, *resources.ApplicationError)
CallServiceByte is a function to call another service return byte data
type PanicHandlerController ¶
type PanicHandlerController struct { Slack interfaces.ISlackWebhook SlackConfig *SlackWebhook Logger interfaces.ILogger }
func (*PanicHandlerController) GetPanicAndSendToSlack ¶
func (pc *PanicHandlerController) GetPanicAndSendToSlack(c *gin.Context, serviceName, message string) error
func (*PanicHandlerController) SetPanicResp ¶
func (pc *PanicHandlerController) SetPanicResp(c *gin.Context, serviceName, message string) *resources.PanicHandlerResponse
func (*PanicHandlerController) SetPayloadSlack ¶
func (pc *PanicHandlerController) SetPayloadSlack(resp *resources.PanicHandlerResponse) slack.Payload
type PostgreSQLHandler ¶
Database struct
func (*PostgreSQLHandler) Begin ¶
func (d *PostgreSQLHandler) Begin() (interfaces.IDBTx, error)
func (*PostgreSQLHandler) Close ¶
func (d *PostgreSQLHandler) Close()
func (*PostgreSQLHandler) Commit ¶
func (d *PostgreSQLHandler) Commit() error
func (*PostgreSQLHandler) ConnectDB ¶
func (d *PostgreSQLHandler) ConnectDB( dbAccRead *resources.DBAccount, dbAccWrite *resources.DBAccount, )
func (*PostgreSQLHandler) DriverName ¶
func (d *PostgreSQLHandler) DriverName() string
func (*PostgreSQLHandler) Exec ¶
func (d *PostgreSQLHandler) Exec(query string, args ...interface{}) (sql.Result, error)
func (*PostgreSQLHandler) ExecContext ¶
func (*PostgreSQLHandler) Get ¶
func (d *PostgreSQLHandler) Get(dest interface{}, query string, args ...interface{}) error
func (*PostgreSQLHandler) GetContext ¶
func (d *PostgreSQLHandler) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
func (*PostgreSQLHandler) In ¶
func (d *PostgreSQLHandler) In(query string, params ...interface{}) (string, []interface{}, error)
func (*PostgreSQLHandler) Query ¶
func (d *PostgreSQLHandler) Query(query string, args ...interface{}) (*sql.Rows, error)
func (*PostgreSQLHandler) QueryContext ¶
func (*PostgreSQLHandler) QueryRow ¶
func (d *PostgreSQLHandler) QueryRow(query string, args ...interface{}) *sql.Row
QueryRow executes a query that is expected to return at most one row. QueryRow always returns a non-nil value. Errors are deferred until Row's Scan method is called. If the query selects no rows, the *Row's Scan will return ErrNoRows. Otherwise, the *Row's Scan scans the first selected row and discards the rest.
func (*PostgreSQLHandler) QueryRowSqlx ¶
func (d *PostgreSQLHandler) QueryRowSqlx(query string, args ...interface{}) *sqlx.Row
func (*PostgreSQLHandler) Queryx ¶
func (d *PostgreSQLHandler) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
func (*PostgreSQLHandler) Rebind ¶
func (d *PostgreSQLHandler) Rebind(query string) string
func (*PostgreSQLHandler) Rollback ¶
func (d *PostgreSQLHandler) Rollback() error
func (*PostgreSQLHandler) Select ¶
func (d *PostgreSQLHandler) Select(dest interface{}, query string, args ...interface{}) error
func (*PostgreSQLHandler) TransactionBlock ¶
type RedisHandler ¶
type RedisHandler struct { Client *redis.Client Pipe redis.Pipeliner PipeCounter int RH *rejson.Handler RS map[string]*redisearch.Client Pool *redigo.Pool Redisync *redsync.Redsync }
RedisHandler is a struct for save redis Client and a receiver
func (*RedisHandler) ConnectRedis ¶
func (r *RedisHandler) ConnectRedis(ra *resources.RedisAccount)
ConnectRedis make redis connection
func (*RedisHandler) CreateRedisMutex ¶
func (r *RedisHandler) CreateRedisMutex(key string, options ...redsync.Option) *redsync.Mutex
func (*RedisHandler) CreateRedisync ¶
func (r *RedisHandler) CreateRedisync() *redsync.Redsync
func (*RedisHandler) Del ¶
func (r *RedisHandler) Del(keys ...string) error
Del data in redis from keys (one, or more than one key)
func (*RedisHandler) GetSet ¶
func (r *RedisHandler) GetSet(key string, data interface{}) error
GetSet get and insert data to redis
func (*RedisHandler) HGetAll ¶
func (r *RedisHandler) HGetAll(key string) (map[string]string, error)
HGetAll get hash redis data all fields
func (*RedisHandler) HMGet ¶
func (r *RedisHandler) HMGet(key string, fields ...string) ([]interface{}, error)
HMGet get hash data from redis
func (*RedisHandler) HMSet ¶
func (r *RedisHandler) HMSet(key string, data interface{}) error
HMSet insert hash data to redis type hash
func (*RedisHandler) HMSetEx ¶
func (r *RedisHandler) HMSetEx(key string, parameter resources.SetExParameter) error
HMSet insert hash data to redis type hash with Expiration (TTL)
func (*RedisHandler) JSONDel ¶
func (r *RedisHandler) JSONDel(key, path string) (interface{}, error)
func (*RedisHandler) JSONGet ¶
func (r *RedisHandler) JSONGet(key string) (interface{}, error)
func (*RedisHandler) JSONMGet ¶
func (r *RedisHandler) JSONMGet(path string, keys ...string) (interface{}, error)
func (*RedisHandler) JSONSet ¶
func (r *RedisHandler) JSONSet(key string, data interface{}) (interface{}, error)
func (*RedisHandler) Keys ¶
func (r *RedisHandler) Keys(pattern string) ([]string, error)
Get data with pattern note : avoid pattern '*' for keys lookup. Consider adding prefix and/or suffix on the pattern.
func (*RedisHandler) LLen ¶
func (r *RedisHandler) LLen(key string) (int64, error)
LLen func to get total list
func (*RedisHandler) LPush ¶
func (r *RedisHandler) LPush(key string, value ...interface{}) error
LPush func to push into list
func (*RedisHandler) LockRedisMutex ¶
func (r *RedisHandler) LockRedisMutex(mutex *redsync.Mutex, tries int) error
func (*RedisHandler) Pipeline ¶
func (r *RedisHandler) Pipeline()
func (*RedisHandler) SAdd ¶
func (r *RedisHandler) SAdd(key string, data ...interface{}) error
SAdd add members to a set stored in redis to a key. if key not exists, will create new and add member
func (*RedisHandler) SIsMember ¶
func (r *RedisHandler) SIsMember(key string, data interface{}) (bool, error)
SIsMember will return true if data is member of set stored at a key or false if data is not member of set stored at a key
func (*RedisHandler) Scan ¶
func (r *RedisHandler) Scan(key string) ([]string, error)
Scan accept wildcard for searching ex : users*
func (*RedisHandler) Set ¶
func (r *RedisHandler) Set(key string, data interface{}) error
Set insert data to redis in string type
func (*RedisHandler) SetEx ¶
func (r *RedisHandler) SetEx(key string, parameter resources.SetExParameter) error
SetEx insert data to old redis in string type with Expiration (TTL)
type SlackWebhook ¶
type SlackWebhook struct { SlackWebhookEnv string SlackWebhookURL string SlackWebhookChannel string SlackToken string SlackUploadFilePath string }
func NewSlackWebhook ¶
func NewSlackWebhook(opts ...SlackWebhookFuncOption) *SlackWebhook
func (*SlackWebhook) Assign ¶
func (sw *SlackWebhook) Assign(opts ...SlackWebhookFuncOption) *SlackWebhook
func (*SlackWebhook) Send ¶
func (s *SlackWebhook) Send(webhookURL, proxy string, payload slack.Payload) []error
sending report image and text Send ...
func (*SlackWebhook) SendWebhook ¶
func (sw *SlackWebhook) SendWebhook(ctx context.Context, payload slackAPI.WebhookMessage) (err error)
type SlackWebhookFuncOption ¶
type SlackWebhookFuncOption func(*SlackWebhook)
func WithWebhook ¶
func WithWebhook(url string, channel string) SlackWebhookFuncOption