Documentation
¶
Overview ¶
Package core - Defines variables/constants and provides utilty functions
Index ¶
- Constants
- Variables
- func CleanHost(host string) string
- func CleanHosts(hosts []string) []string
- func CleanPath(path string) string
- func ContainsString(s []string, v string) bool
- func ContextWithSignal(ctx context.Context) context.Context
- func ExtractPlaceHoldersFromURLTemplate(subject string, pattern *regexp.Regexp) []string
- func FromJSON(data string, target interface{}) error
- func GCD(x, y int) int
- func GetBool(data map[string]interface{}, key string) bool
- func GetClientIPHelper(req *http.Request) (string, error)
- func GetInt64(data map[string]interface{}, key string) int64
- func GetLastPart(source, seperater string) string
- func GetParameteredPath(path string, params []string) string
- func GetResponseString(resp *http.Response) (string, error)
- func GetString(data map[string]interface{}, key string) string
- func GetStrings(data map[string]interface{}, name string) []string
- func IsZeroOfUnderlyingType(t interface{}) bool
- func JSONDecode(source io.Reader, target interface{}) error
- func JSONMarshal(data interface{}) ([]byte, error)
- func JSONUnmarshal(source []byte, target interface{}) error
- func NewWrappedError(code int, message string, originalError error) error
- func ParameterExtractPattern(disableStrictREST bool) *regexp.Regexp
- func RemoveSlice(arr []interface{}, idx int) []interface{}
- func ToJSON(data interface{}) string
- type StringInterfaceMap
- type WrappedError
Constants ¶
const ( // AppName - 어플리케이션 명 AppName = "cb-restapigw" // AppVersion - 어플리케이션 버전 AppVersion = "0.1.0" // AppHeaderName - 어플리케이션 식별을 위한 Header 관리 명 AppHeaderName = "X-CB-RESTAPIGW" // AppUserAgent - Backend 전달에 사용할 User Agent Header 값 AppUserAgent = AppName + " version " + AppVersion // CollectionTag - Backend의 Array를 Json 객체의 데이터로 반환 처리를 위한 Tag Name CollectionTag = "collection" // WrappingTag - Backend의 Array 직접 반환 처리를 위한 Tag Name WrappingTag = "!!wrapping!!" // Bypass - Endpoint/Backend Bypass 처리용 식별자 Bypass = "*bypass" // RequestIDKey - Request ID 추적을 위한 Key RequestIDKey requestIDKeyType = iota )
Variables ¶
var ( // SimpleURLKeysPattern - 일반적 URL 패턴 SimpleURLKeysPattern = regexp.MustCompile(`\{([a-zA-Z\-_0-9]+)\}`) // SequentialParamsPattern - Sequential 처리용 URL 패턴 (전 수행의 결과를 파라미터로 지정하는 경우) SequentialParamsPattern = regexp.MustCompile(`^resp[\d]+_.*$`) // DebugPattern - Debug URL 패턴 DebugPattern = "^[^/]|/__debug(/.*)?$" // URLKeyPattern - URL 에 대한 파라미터 처리를 위한 패턴 "{...}" URLKeyPattern = regexp.MustCompile(`/\{([a-zA-Z\-_0-9]+)\}`) // HOSTPattern - Host URL 패턴 HOSTPattern = regexp.MustCompile(`(https?://)?([a-zA-Z0-9\._\-]+)(:[0-9]{2,6})?/?`) )
Functions ¶
func ContainsString ¶
ContainsString returns true if a string is present in a iteratee.
func ContextWithSignal ¶
ContextWithSignal - OS Interrupt signal 연계 처리를 위한 Context 구성
func ExtractPlaceHoldersFromURLTemplate ¶
ExtractPlaceHoldersFromURLTemplate - URL에 설정되어 있는 Placeholder를 추출한 문자열들 반환
func GetClientIPHelper ¶
GetClientIPHelper - Request 기반의 Client IP를 검증
func GetLastPart ¶
GetLastPart - 지정한 문자열을 지정한 문자로 분리하고 마지막 부분 반환
func GetParameteredPath ¶
GetParameteredPath - 지정된 URI Path에 대해 파라미터를 설정
func GetResponseString ¶
GetResponseString - http.Response Body를 문자열로 반환
func GetStrings ¶
GetStrings - 지정된 맵 데이터에서 지정된 이름에 해당하는 데이터를 []string 으로 반환
func IsZeroOfUnderlyingType ¶
func IsZeroOfUnderlyingType(t interface{}) bool
IsZeroOfUnderlyingType - 지정한 형식의 Zero Value 상태인지 검증
func JSONDecode ¶
JSONDecode - 지정한 Source의 JSON 정보를 지정한 Target으로 설정
func JSONMarshal ¶
JSONMarshal - 지정한 정보를 JSON 으로 Marshal 처리
func JSONUnmarshal ¶
JSONUnmarshal - 지정한 JSON 문자열 Byte를 지정한 Target으로 설정
func NewWrappedError ¶
NewWrappedError - 원본 오류를 관리하는 오류 생성
func ParameterExtractPattern ¶
ParameterExtractPattern - 파라미터 추출에 사용할 패턴 반환
func RemoveSlice ¶
func RemoveSlice(arr []interface{}, idx int) []interface{}
RemoveSlice - 지정한 배열 구조에서 지정한 인덱스의 값을 삭제하고 반환
Types ¶
type StringInterfaceMap ¶
type StringInterfaceMap map[string]interface{}
StringInterfaceMap - 문자열 인자를 가기는 interface{} Map 형식
type WrappedError ¶
type WrappedError struct {
// contains filtered or unexported fields
}
WrappedError - 원본 오류를 관리하는 오류 형식
Directories
¶
Path | Synopsis |
---|---|
adapters
|
|
gin
Package gin - GIN 기반으로 표준 HTTP 연계 기능을 제공하는 패키지
|
Package gin - GIN 기반으로 표준 HTTP 연계 기능을 제공하는 패키지 |
atomic - 각 데이터 형식에 대한 Atomic 제공 패키지
|
atomic - 각 데이터 형식에 대한 Atomic 제공 패키지 |
Package defaults - Golang Structure에 Defaults 값 설정 기능 제공 패키지 Package defaults -
|
Package defaults - Golang Structure에 Defaults 값 설정 기능 제공 패키지 Package defaults - |
flatmap
|
|
Package rand - Fast Random 기능 제공 패키지
|
Package rand - Fast Random 기능 제공 패키지 |