Coder Social home page Coder Social logo

xutil's Introduction

Produced by OpenMix: https://openmix.org

Mix XUtil

A set of tools that keep Golang sweet.

Installation

go get github.com/mix-go/xutil

xslices

Function Description
xslices.InArray[T comparable](item T, slice []T) bool Searches if the specified value exists in the array.

xstrings

Function Description
xstrings.IsNumeric(s string) bool Used to check if the variable is a number or a numeric string.
xstrings.SubString(s string, start int, length int) string Return part of a string
xstrings.Capitalize(s string) string The function converts the first letter of the input string to uppercase.

xconv

Function Description
xconv.StructToMap(i interface{}) map[string]interface{} Convert struct to map.
xconv.StringToBytes(s string) []byte Convert string to bytes (0 copy).
xconv.BytesToString(b []byte) string Convert bytes to bytes (0 copy).

xcrypt

Function Description
xcrypt.AESEncrypt(plainText, mode, key, iv string) (string, error) AES encryption
xcrypt.AESDecrypt(cipherText, mode, key, iv string) (string, error) AES Decryption

xfmt [more]

A formatting library that can print data inside nested pointer addresses of structures.

The supported methods are identical to the fmt system library

Function Description
xfmt.Sprintf(format string, args ...interface{}) string
xfmt.Sprint(args ...interface{}) string
xfmt.Sprintln(args ...interface{}) string
xfmt.Printf(format string, args ...interface{})
xfmt.Print(args ...interface{})
xfmt.Println(args ...interface{})
xfmt.Disable() Equivalent to fmt when disabled
xfmt.Enable()

xenv [more]

Environment configuration library with type conversion.

Function Description
err := xenv.Load(".env")
err := xenv.Overload(".env")
i := xenv.Getenv("key").String("default")
i := xenv.Getenv("key").Bool(false)
i := xenv.Getenv("key").Int64(123)
i := xenv.Getenv("key").Float64(123.4)

License

Apache License Version 2.0, http://www.apache.org/licenses/

xutil's People

Contributors

onanying avatar

Stargazers

 avatar zhanglei avatar  avatar

Watchers

 avatar

Forkers

zhanglei

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.