util

package
v0.0.0-...-6b32d26 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 26

Documentation

Overview

Copyright 2021 SANGFOR TECHNOLOGIES

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIP

func CheckIP(ip string) error

CheckIP check if ip is valid

func CheckPort

func CheckPort(port string) (err error)

CheckPort check if port is between 1000 and 65535

func CheckVersion

func CheckVersion(version string) error

CheckVersion check if version is with format x.y.z

func GetClusterHint

func GetClusterHint(params map[string]string) string

func GetHint

func GetHint(params map[string]string) string

GetHint get query hint

func HasString

func HasString(elem string, arr []string) bool

HasString determine if a string element is in a string array

func IntCompare

func IntCompare(v1 string, v2 string) (bool, bool, error)

IntCompare check if v1 is higher than v2

func IsGTEVersion

func IsGTEVersion(v1 string, v2 string) (error, bool)

IsGTEVersion check if version v1 is gte v2

func IsNil

func IsNil(i interface{}) bool

IsNil check if value is nil or not

func Random

func Random(length int) string

Random generate random string with specified length

func RandomExpirationSecond

func RandomExpirationSecond(expiration int) time.Duration

RandomExpirationSecond random expiration

func RandomHash

func RandomHash() string

RandomHash get random string with 64 length

func RandomHash32

func RandomHash32() string

RandomHash get random string with 32 length

func RandomPort

func RandomPort(start int, end int) int

RandomPort get random between start and end,[start,end)

func RegexpMatchPattern

func RegexpMatchPattern(s string, regexpPatterns []string) bool

RegexpMatchPattern returns true if s matches any of the provided regexpPatterns

func SemicolonTerminated

func SemicolonTerminated(statement string) string

SemicolonTerminated is a utility function that makes sure a statement is terminated with a semicolon, if it isn't already

Types

This section is empty.

Directories

Path Synopsis
Copyright 2021 SANGFOR TECHNOLOGIES
Copyright 2021 SANGFOR TECHNOLOGIES

Jump to

Keyboard shortcuts

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