Documentation ¶
Index ¶
- Constants
- type AppConfig
- type ApplicationError
- type DBAccount
- type PanicHandlerResponse
- type RedisAccount
- type Resilience
- type Retrier
- type SectionAWS
- type SectionAWSItem
- type SectionBasicAuth
- type SectionConsumer
- type SectionContext
- type SectionCore
- type SectionDB
- type SectionExternalAPI
- type SectionGRPC
- type SectionGoogle
- type SectionHTTP
- type SectionJWT
- type SectionLogger
- type SectionMidtrans
- type SectionService
- type SectionSlack
- type SectionTimeout
- type SectionToken
- type SectionXendit
- type SetExParameter
Constants ¶
View Source
const ( DatabaseMySQL = "DBMySQL" DatabasePostgreSQL = "DBPostgreSQL" RedisDefault = "redis" NotFound = "not_found" //http status strings StatusBadRequest = "bad_request" StatusNotFound = "not_found" StatusRequestTimeout = "timeout" StatusExpectationFailed = "failed" StatusInternalServerError = "internalError" StatusTokenExpired = "token_expired" StatusForbidden = "forbidden" StatusBadRequestMessage = "bad request" StatusNotFoundMessage = "data not found" StatusOKMessage = "ok" StatusTokenExpiredMessage = "token expired" StatusUnprocessableEntity = "status unprocessable entity" StatusOK = "status_ok" //GIN Release = "release" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct { Gateway string `json:",omitempty" mapstructure:"gateway"` ProjectID string `json:",omitempty"` Context SectionContext `json:",omitempty"` HTTPConfig SectionHTTP `json:",omitempty" mapstructure:"httpconfig"` ConsumerConfig SectionConsumer `json:",omitempty"` Core SectionCore `json:",omitempty" mapstructure:"core"` Token SectionToken `json:",omitempty"` ExternalAPI SectionExternalAPI `json:",omitempty"` GINMode string `json:",omitempty"` Log SectionLogger `json:",omitempty"` Resilience Resilience `json:",omitempty" mapstructure:"resilience"` LogLevel string `json:",omitempty"` }
AppConfig is main struct for configuration
type ApplicationError ¶
type ApplicationError struct { Message string `json:"message"` StatusCode int `json:"status"` Code string `json:"code"` Success bool `json:"success"` }
ApplicationError is the struct that defines error on HTTP call (status code except 200 & 201)
type DBAccount ¶
type DBAccount struct { Username string `json:",omitempty" mapstructure:"username"` Password string `json:",omitempty" mapstructure:"password"` URL string `json:",omitempty" mapstructure:"url"` Port string `json:",omitempty" mapstructure:"port"` DBName string `json:",omitempty" mapstructure:"dbname"` Flavor string `json:",omitempty" mapstructure:"flavor"` MaxIdleConns int `json:",omitempty" mapstructure:"maxidleconns"` MaxOpenConns int `json:",omitempty" mapstructure:"maxopenconns"` MaxLifeTime int `json:",omitempty" mapstructure:"maxlifetime"` Location string `json:",omitempty" mapstructure:"location"` Timeout string `json:",omitempty" mapstructure:"timeout"` }
DBAccount is struct for database configuration or database account
type PanicHandlerResponse ¶
type PanicHandlerResponse struct { Service string `json:"service"` URL string `json:"url.omitempty"` Method string `json:"method,omitempty"` Env string `json:"env"` StatusCode int64 `json:"status_code"` Status string `json:"status,omitempty"` Context string `json:"context,omitempty"` Message string `json:"message"` }
PanicHandlerResponse is a struct that holds the detail of a Panic event
type RedisAccount ¶
type RedisAccount struct { URL string `json:",omitempty" mapstructure:"url"` Port int `json:",omitempty" mapstructure:"port"` DB int `json:",omitempty" mapstructure:"db"` Password string `json:",omitempty" mapstructure:"password"` PoolSize int `json:",omitempty" mapstructure:"poolsize"` MinIdleConns int `json:",omitempty" mapstructure:"minidleconns"` MaxIdle int `json:",omitempty" mapstructure:"maxidle"` MaxActive int `json:",omitempty" mapstructure:"maxactive"` MaxConnLifetime int `json:",omitempty" mapstructure:"maxconnlifetime"` RedisearchIndex []string `json:",omitempty"` RedisMutexExpiryTime int `json:",omitempty"` RedisMutexLockTries int `json:",omitempty"` }
type Resilience ¶
type Resilience struct {
Retrier Retrier `json:",omitempty" mapstructure:"retrier"`
}
type SectionAWS ¶
type SectionAWS struct { SES SectionAWSItem `json:",omitempty"` S3 SectionAWSItem `json:",omitempty"` }
type SectionAWSItem ¶
type SectionBasicAuth ¶
type SectionConsumer ¶
type SectionConsumer struct {
Timeout int `json:",omitempty"`
}
SectionConsumer for config consumer
type SectionContext ¶
type SectionContext struct {
Timeout int `json:",omitempty"`
}
type SectionCore ¶
type SectionCore struct {
Kvothe SectionService `json:",omitempty"`
}
type SectionExternalAPI ¶
type SectionExternalAPI struct { AWS SectionAWS `json:",omitempty"` Google SectionGoogle `json:",omitempty"` Xendit SectionXendit `json:",omitempty"` Midtrans SectionMidtrans `json:",omitempty"` }
type SectionGRPC ¶
type SectionGRPC struct {
Port string `json:",omitempty" mapstructure:"port"`
}
type SectionGoogle ¶
type SectionGoogle struct {
APIKey string `json:",omitempty"`
}
type SectionHTTP ¶
type SectionHTTP struct { Timeout int `json:",omitempty" mapstructure:"timeout"` DisableKeepAlive bool `json:",omitempty" mapstructure:"disablekeepalive"` }
SectionHTTP is a config for http request
type SectionJWT ¶
type SectionJWT struct { JWTSecretKey string `json:",omitempty"` JWTRefreshSecretKey string `json:",omitempty"` JWTExpiration int `json:",omitempty"` JWTRefreshExpiration int `json:",omitempty"` }
SectionJWT is a config for JWT
type SectionLogger ¶
type SectionMidtrans ¶
type SectionService ¶
type SectionService struct { Name string `json:",omitempty" mapstructure:"name"` Environment string `json:",omitempty" mapstructure:"environment"` Version string `json:",omitempty" mapstructure:"version"` Port string `json:",omitempty" mapstructure:"port"` Protocol string `json:",omitempty" mapstructure:"protocol"` Hostname string `json:",omitempty" mapstructure:"hostname"` Gateway string `json:",omitempty" mapstructure:"gateway"` LogLevel int `json:",omitempty" mapstructure:"loglevel"` IsEnable bool `json:",omitempty"` FirstDB string `json:",omitempty"` GRPC SectionGRPC `json:",omitempty"` DBPostgres SectionDB `json:",omitempty" mapstructure:"dbpostgres"` Redis RedisAccount `json:",omitempty" mapstructure:"redis"` Timeout SectionTimeout `json:",omitempty"` AWS SectionAWS `json:",omitempty"` AppKey string `json:",omitempty"` DomainFrontend string `json:",omitempty" mapstructure:"domainfrontend"` JWT SectionJWT `json:",omitempty"` ExternalJWT SectionJWT `json:",omitempty"` BasicAuth SectionBasicAuth `json:",omitempty"` Slack SectionSlack `json:",omitempty"` MaxProccess int `json:",omitempty"` }
SectionService is a struct for Service Configuration
type SectionSlack ¶
type SectionSlack struct { WebhookURL string `json:"webhook_url,omitempty" mapstructure:"webhookurl"` WebhookChannel string `json:"webhook_channel,omitempty" mapstructure:"webhookchannel"` IsEnableSlack bool `json:"is_enable_slack,omitempty" mapstructure:"isenableslack"` VerificationToken string `json:"verification_token,omitempty" mapstructure:"verificationtoken"` BotToken string `json:"bot_token,omitempty" mapstructure:"bottoken"` ChannelID string `json:"channel_id,omitempty" mapstructure:"channelid"` Icon string `json:"icon,omitempty" mapstructure:"icon"` }
type SectionTimeout ¶
SectionTimeout for service timeout in second
type SectionToken ¶
type SectionToken struct { TokenKey string `json:",omitempty"` RefreshTokenKey string `json:",omitempty"` TokenDaySecond int `json:",omitempty"` TokenMonthSecond int `json:",omitempty"` BasicAuth SectionBasicAuth `json:",omitempty"` }
SectionToken is a config for Token
type SectionXendit ¶
type SetExParameter ¶
type SetExParameter struct { //Data is the data that will be saved Data interface{} //ExpireDuration is the TTL of the key ExpireDuration time.Duration //IsTesting is the flag to define if the SetEx is called during the load test IsTesting bool }
SetExParameter is the struct that defines parameters that are required for calling SetEx
Click to show internal directories.
Click to hide internal directories.