common

package
v0.0.0-...-c5987b8 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log *log.Entry
View Source
var Port = conf.AppConfig.UString("port")

Functions

func ChangeOldAppPort

func ChangeOldAppPort()

func CheckInSlice

func CheckInSlice(str string, list []string) bool

util,check exists in slice

func CheckIntersect

func CheckIntersect(original, extras []string) bool

util, check slices intersects

func ClearPid

func ClearPid()

clear pid

func DetectPortIsFree

func DetectPortIsFree() bool

detect free port

func FileExists

func FileExists(name string) bool

check file exists

func InitLogger

func InitLogger(headers *HttpLib)

init logger with headers

func LogErr

func LogErr()

recover after panic, log traceback

func ReadPid

func ReadPid() int

pid reader

func RemoveStringFromStringSlice

func RemoveStringFromStringSlice(str string, elements []string) []string

util, remove string from slice

func ReplacePid

func ReplacePid()

func SliceCountValues

func SliceCountValues(input []string) map[string]int

func StringReplaceBySlice

func StringReplaceBySlice(subject string, search, replace []string) string

replace substrings in string by search=>replace slices

func WritePid

func WritePid(pid int)

pid writer

Types

type CommonCache

type CommonCache struct {
	// contains filtered or unexported fields
}
var Cache *CommonCache

func (*CommonCache) Forget

func (c *CommonCache) Forget(key string) bool

clear cache value by key

func (*CommonCache) Get

func (c *CommonCache) Get(key string) (interface{}, bool)

get cache value by key

func (*CommonCache) Has

func (c *CommonCache) Has(key string) bool

check cache key is exists

func (*CommonCache) Set

func (c *CommonCache) Set(key string, value interface{}, minutes int)

set cache value, if minutes is 0 - caching forever

type HttpLib

type HttpLib struct {
	XCallingService string `json:"x_calling_service"`
	XCallingMethod  string `json:"x_calling_method"`
}

request headers

func (*HttpLib) GetRequestHeaders

func (h *HttpLib) GetRequestHeaders(request *http.Request) *HttpLib

func (*HttpLib) ResponseWriter

func (h *HttpLib) ResponseWriter(request *http.Request, w http.ResponseWriter, response interface{})

gzip/plain writer

Jump to

Keyboard shortcuts

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