utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SuccessResponse = ResponseNilMsg{Status: "ok"}
)

Functions

func CheckAddressByTcp

func CheckAddressByTcp(address string, port int, timeout time.Duration, logger logr.Logger) (bool, error)

func CheckAddressSSHLived

func CheckAddressSSHLived(address string, timeSecond time.Duration, logger logr.Logger) bool

func ContainsString

func ContainsString(slice []string, s string, modifier func(s string) string) bool

func FormatString

func FormatString(str string) string

func MapMerge

func MapMerge(m1 map[string]interface{}, m2 map[string]interface{}) map[string]interface{}

func MapMergeString

func MapMergeString(m1 map[string]string, m2 map[string]string) map[string]string

func MaxIntSlice

func MaxIntSlice(v []int) int

func ParseInput

func ParseInput(logger logr.Logger, request *restful.Request, response *restful.Response, params ...string) ([]string, error)

func RandPassword

func RandPassword() string

func RandString

func RandString(n int) string

func ReadHttpPostBody

func ReadHttpPostBody(logger logr.Logger, request *restful.Request, response *restful.Response) ([]byte, error)

func RemoveString

func RemoveString(slice []string, s string, modifier func(s string) string) []string

func SortStrings

func SortStrings(s []string) []string

Types

type CacheProvider

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

func GetCacheProvider

func GetCacheProvider() *CacheProvider

func (*CacheProvider) Add

func (c *CacheProvider) Add(key string, value interface{}) error

func (*CacheProvider) Delete

func (c *CacheProvider) Delete(key string) error

func (*CacheProvider) Get

func (c *CacheProvider) Get(key string) (value interface{}, exists bool, err error)

func (*CacheProvider) Update

func (c *CacheProvider) Update(key string, value interface{}) error

type ResponseNilMsg

type ResponseNilMsg struct {
	Status string `json:"status"`
}

type ResponseWithMsg

type ResponseWithMsg struct {
	Status string                 `json:"status"`
	Msg    map[string]interface{} `json:"msg"`
}

func ResponseSucInitFactory

func ResponseSucInitFactory() *ResponseWithMsg

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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