utility

package
v0.0.0-...-75e9581 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MachingIPAddress = func() string {
	if machingIPAddress == "" {
		conn, err := net.Dial("udp", "8.8.8.8:80")
		if err != nil {
			log.Fatal(err)
		}
		defer conn.Close()

		machingIPAddress = conn.LocalAddr().(*net.UDPAddr).IP.String()
	}

	return machingIPAddress
}()

Functions

func ConvertMapToObject

func ConvertMapToObject(data map[string]interface{}, obj interface{}) error

func ConvertStructToMap

func ConvertStructToMap(i interface{}) (map[string]interface{}, error)

func GetContentFile

func GetContentFile(filename string) string

func GetPercentage

func GetPercentage(total int, value int) float32

func InsertNewLine

func InsertNewLine(s string, args ...int) string

每多少字換行

func ParserGetPutCommand

func ParserGetPutCommand(msg string) (objectNum int, objectName string, containNum int, containerName string)

func ParserObjectNumber

func ParserObjectNumber(str string) (num int, name string)

func SplitCommand

func SplitCommand(inputStr string) (cmd string, para string)

func ToCyan

func ToCyan(str string, num ...int) string

func UnmarshalJsonFile

func UnmarshalJsonFile(filePath string, targetObjectType interface{}) error

func ValidateStringLengRange

func ValidateStringLengRange(input string, min int, max int) error

Types

type RestString

type RestString string

func (*RestString) Replace

func (s *RestString) Replace(old string, new string) *RestString

func (*RestString) String

func (s *RestString) String() string

Jump to

Keyboard shortcuts

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