Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s1s1ty/goin
`in` operator for go
https://github.com/s1s1ty/goin
goin golang golang-in interface map string
Last synced: about 2 months ago
JSON representation
`in` operator for go
- Host: GitHub
- URL: https://github.com/s1s1ty/goin
- Owner: s1s1ty
- License: mit
- Created: 2018-03-30T17:53:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-09T06:16:38.000Z (almost 7 years ago)
- Last Synced: 2024-06-20T12:50:14.763Z (7 months ago)
- Topics: goin, golang, golang-in, interface, map, string
- Language: Go
- Homepage: https://godoc.org/github.com/s1s1ty/goin
- Size: 25.4 KB
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# goin
[![Go Report Card](https://goreportcard.com/badge/github.com/s1s1ty/goin)](https://goreportcard.com/report/github.com/s1s1ty/goin)
[![Build Status](https://travis-ci.org/s1s1ty/goin.svg?branch=master)](https://travis-ci.org/s1s1ty/goin)
[![license](https://img.shields.io/github/license/s1s1ty/goin.svg)](https://github.com/s1s1ty/goin/blob/master/LICENSE)
[![GoDoc](https://godoc.org/github.com/s1s1ty/goin?status.svg)](https://godoc.org/github.com/s1s1ty/goin)**goin** Evaluates to true if it finds a variable in the specified sequence and false otherwise.
* **goin** package is built inspired by **python** **in** operator
## Installation and Usage
Install the package with:
```
go get github.com/s1s1ty/goin
```
Import it with:
```go
import "github.com/s1s1ty/goin"
```## Quick Start
```go
func main() {
ar := []int{1, 2, 4, 7, 8, 3}
found, _ := goin.Value(7).In(ar)
fmt.Println(found) // trueseq := []float64{1.11, 3.20, 5.89, 2.90}
found, _ = goin.Value(2.9).In(seq)
fmt.Println(found) // truedict := map[string]string{"name": "shaon", "id": "110"}
found, _ = goin.Value("fullname").InKey(dict)
fmt.Println(found) // false
}
```
## Available Methods- `In(arr interface{})`
- `InKey(arr interface{})`#### License
Licenced under MIT Licence##### Any Suggestions and Bug Report will be gladly appreciated.