core

package module
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: AGPL-3.0 Imports: 8 Imported by: 1

README

core-go

Common core utils across based on Cellularhacker's code written in Go.

Usage

  • How to import?
go get -u github.com/Cellularhacker/core-go

※ Important

  • package name is just core. so you have to use like core.IsProductionMode(), not core-go.IsProductionMode().

Documentation

Index

Constants

View Source
const (
	ValueEnvModeProduction  = "production"
	ValueEnvModeDevelopment = "development"

	KeyEnvMode = "MODE"
)

MARK: For Program's running mode settings

View Source
const (
	ValueEnvAsiaSeoul = "Asia/Seoul"
	ValueEnvAsiaTokyo = "Asia/Tokyo"

	KeyEnvLocation = "LOCATION"
)

MARK: For Program's localization settings

View Source
const (
	DateTimeFormatAddTimeZone = "2006-01-02 15:04:05 MST"
)

Variables

View Source
var HttpErrors = []error{
	errors.New("out of retries to try fetch HTTP(S) request"),
}

HttpErrors : that could be happened during~end of the HTTP(S) Requests in Unexpected errors or Custom errors.

Functions

func GetLoc added in v1.0.1

func GetLoc() *time.Location

func GetLocation added in v1.0.1

func GetLocation() *time.Location

func IsDM

func IsDM(mode ...string) bool

func IsDevelopmentMode

func IsDevelopmentMode(mode ...string) bool

func IsPM

func IsPM(mode ...string) bool

func IsProductionMode

func IsProductionMode(mode ...string) bool

func LocationJST added in v1.0.5

func LocationJST() *time.Location

func LocationKST added in v1.0.5

func LocationKST() *time.Location

func ParseDatetimeInTimeZone added in v1.0.5

func ParseDatetimeInTimeZone(layout string, value string, TZ *time.Location) (time.Time, error)

func SetLoc added in v1.0.6

func SetLoc(tz *time.Location)

Types

type HttpClient added in v1.0.7

type HttpClient struct {
	// contains filtered or unexported fields
}

HttpClient : The struct for using HTTP(S) Requests.

func GetHttpClient added in v1.0.7

func GetHttpClient() *HttpClient

func (*HttpClient) Do added in v1.0.7

func (hc *HttpClient) Do(req *http.Request) (*http.Response, error)

func (*HttpClient) GetMaxRetriesCount added in v1.0.7

func (hc *HttpClient) GetMaxRetriesCount() int

func (*HttpClient) GetRetryDelay added in v1.0.7

func (hc *HttpClient) GetRetryDelay() time.Duration

func (*HttpClient) SetMaxRetries added in v1.0.7

func (hc *HttpClient) SetMaxRetries(maxRetries int) *HttpClient

func (*HttpClient) SetRetryDelay added in v1.0.7

func (hc *HttpClient) SetRetryDelay(retryDelay time.Duration) *HttpClient

func (*HttpClient) SetUserAgentAndroid added in v1.0.7

func (hc *HttpClient) SetUserAgentAndroid(req *http.Request) *http.Request

func (*HttpClient) SetUserAgentMacOS added in v1.0.7

func (hc *HttpClient) SetUserAgentMacOS(req *http.Request) *http.Request

SetUserAgentMacOS : Based on Macbook Pro Chrome

func (*HttpClient) SetUserAgentiPhone added in v1.0.7

func (hc *HttpClient) SetUserAgentiPhone(req *http.Request) *http.Request

Jump to

Keyboard shortcuts

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