Giter Club home page Giter Club logo

g's Introduction

G - general framework for go

GoDoc Go Report Card Used By

All built-in golang types:

bool
string
int8, int16, int32, int64, int
uint8, uint16, uint32, uint64, uint
float32, float64
complex64, complex128
rune, byte # aliases for int32 and uint8

Also library supports time.Time type

All supported functions:

XXXInSlice(value T, slice []T) bool      # all types
MaxXXX(a, b T) T                         # intX, uintX, floatX, time.Time types
MaxXXXInSlice(slice []T) (T, error)      # intX, uintX, floatX, time.Time types
MaxWithDeafult(slice []T, default T) T   # intX, uintX, floatX, time.Time types
MinXXX(a, b T) T                         # intX, uintX, floatX, time.Time types
MinXXXInSlice(slice []T) (T, error)      # intX, uintX, floatX, time.Time types
MinWithDeafult(slice []T, default T) T   # intX, uintX, floatX, time.Time types
UniqXXX(slice []T) []T                   # all types
Pxxx(v T) *T                             # all types

Example

package main
import (
    "github.com/mr-tron/g"  
    "fmt"
)

func main() {
    prices := []uint64{15999, 12000, 13490, 99999}
    outTransactions := []uint64{500, 2900, 12000, 980, 500}
    lowestPrice, err  := g.MinUint64InSlice(prices)
    if err != nil {
        fmt.Println("Nobody sells giant dildos. Sorry")
        return
    }
    fmt.Printf("- Did we buy giant dildo on lowest price?\n- %v", g.Uint64InSlice(lowestPrice, outTransactions))
}

g's People

Contributors

mr-tron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.