resources

package
v0.0.0-...-e10a309 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatabaseMySQL      = "DBMySQL"
	DatabasePostgreSQL = "DBPostgreSQL"
	RedisDefault       = "redis"

	NotFound = "not_found"

	//http status strings
	StatusUnauthorized        = "status_unauthorized"
	StatusBadRequest          = "bad_request"
	StatusNotFound            = "not_found"
	StatusRequestTimeout      = "timeout"
	StatusExpectationFailed   = "failed"
	StatusInternalServerError = "internalError"
	StatusTokenExpired        = "token_expired"
	StatusForbidden           = "forbidden"

	StatusUnauthorizedMessage = "status unauthorized"
	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 Retrier

type Retrier struct {
	WaitBase       time.Duration `json:",omitempty" mapstructure:"waitbase"`
	DisableBackoff bool          `json:",omitempty" mapstructure:"disablebackoff"`
	Times          int           `json:",omitempty" mapstructure:"times"`
}

type SectionAWS

type SectionAWS struct {
	SES SectionAWSItem `json:",omitempty"`
	S3  SectionAWSItem `json:",omitempty"`
}

type SectionAWSItem

type SectionAWSItem struct {
	AccessKeyID     string `json:",omitempty"`
	SecretAccessKey string `json:",omitempty"`
	DefaultBucket   string `json:",omitempty"`
	Region          string `json:",omitempty"`
	ScoutPrefix     string `json:",omitempty"`
	URL             string `json:",omitempty"`
	Storage         string `json:",omitempty"`
}

type SectionBasicAuth

type SectionBasicAuth struct {
	Username string
	Password string
}

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 SectionDB

type SectionDB struct {
	READ  DBAccount `json:",omitempty" mapstructure:"read"`
	WRITE DBAccount `json:",omitempty" mapstructure:"write"`
}

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 SectionLogger struct {
	FileName string `json:",omitempty"`
	Mode     string `json:",omitempty"`
}

type SectionMidtrans

type SectionMidtrans struct {
	ClientKey    string `json:",omitempty"`
	APIKey       string `json:",omitempty"`
	ServerKey    string `json:",omitempty"`
	MerchantCode string `json:",omitempty"`
}

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

type SectionTimeout struct {
	Read  int `json:",omitempty"`
	Write int `json:",omitempty"`
}

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 SectionXendit struct {
	PublicKey string `json:",omitempty"`
	APIKey    string `json:",omitempty"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL