Git Product home page Git Product logo

lancet's Introduction


Go version Release GoDoc Go Report Card test codecov License

Lancet is a comprehensive, efficient, and reusable util function library of go. Inspired by the java apache common package and lodash.js.

English | 简体中文

Feature

  • 👏 Comprehensive, efficient and reusable.
  • 💪 180+ go util functions, support string, slice, datetime, net, crypt...
  • 💅 Only depend on the go standard library.
  • 🌍 Unit test for every exported function.

Installation

go get github.com/duke-git/lancet

Usage

Lancet organizes the code into package structure, and you need to import the corresponding package name when use it. For example, if you use string-related functions,import the strutil package like below:

import "github.com/duke-git/lancet/strutil"

Example

Here takes the string function ReverseStr (reverse order string) as an example, and the strutil package needs to be imported.

package main

import (
    "fmt"
    "github.com/duke-git/lancet/strutil"
)

func main() {
    s := "hello"
    rs := strutil.ReverseStr(s)
    fmt.Println(rs) //olleh
}

API Documentation

Convertor package contains some functions for data convertion.

import "github.com/duke-git/lancet/convertor"

Function list:

Cryptor package is for data encryption and decryption.

import "github.com/duke-git/lancet/cryptor"

Function list:

Datetime package supports date and time format and compare.

import "github.com/duke-git/lancet/datetime"

Function list:

Fileutil package implements some basic functions for file operations.

import "github.com/duke-git/lancet/fileutil"

Function list:

Formatter contains some functions for data formatting.

import "github.com/duke-git/lancet/formatter"

Function list:

Function package can control the flow of function execution and support part of functional programming

import "github.com/duke-git/lancet/function"

Function list:

Mathutil package implements some functions for math calculation.

import "github.com/duke-git/lancet/mathutil"

Function list:

Netutil package contains functions to get net information and send http request.

import "github.com/duke-git/lancet/netutil"

Function list:

Random package implements some basic functions to generate random int and string.

import "github.com/duke-git/lancet/random"

Function list:

Retry package is for executing a function repeatedly until it was successful or canceled by the context.

import "github.com/duke-git/lancet/retry"

Function list:

Slice contains some functions to manipulate slice.

import "github.com/duke-git/lancet/slice"

Function list:

Strutil package contains some functions to manipulate string.

import "github.com/duke-git/lancet/strutil"

Function list:

System package contain some functions about os, runtime, shell command.

import "github.com/duke-git/lancet/system"

Function list:

Validator package contains some functions for data validation.

import "github.com/duke-git/lancet/validator"

Function list:

How to Contribute

I really appreciate any code commits which make lancet lib powerful. Please follow the rules below to create your pull request.

  1. Fork the repository.
  2. Create your feature branch.
  3. Commit your changes.
  4. Push to the branch
  5. Create new pull request.

lancet's People

Contributors

ahmadalfy avatar danstis avatar donutloop avatar duke-git avatar rumikk avatar

Watchers

 avatar

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.