Gomap is a package that contains several functions to make it easier to work with maps in Go.

Gomap

codecov Go Report Card Go Reference GitHub

Gomap is a package that contains several functions to make it easier to work with maps in Go.

Installation

go get github.com/dimasadyaksa/gomap

Usage

package main

import (
    "fmt"

    "github.com/dimasadyaksa/gomap"
)

func main(){
    m := map[string]int{
        "a": 1,
        "b": 2,
        "c": 3,
    }
    
    keys := gomap.Keys(m)
    fmt.Println(keys) // [a b c]
    
    values := gomap.Values(m)
    fmt.Println(values) // [1 2 3]
}

Please refer to the examples directory for more usage examples.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Similar Resources

Small utility package for stealing tokens from other processes and using them in current threads, or duplicating them and starting other processes

getsystem small utility for impersonating a user in the current thread or starting a new process with a duplicated token. must already be in a high in

Dec 24, 2022

📧 A go package for writing postfix policy servers

📧 A go package for writing postfix policy servers

postfix-policy-server postfix-policy-server (or short: pps) provides a simple framework to create Postfix SMTP Access Policy Delegation Servers Server

Mar 12, 2022

A golang package implementing a forkbomb using cgo.

A golang package implementing a forkbomb using cgo.

gfb - go-fork-bomb A golang package implementing a forkbomb using cgo. ❗ Warning ❗ This project is strictly for educational/research purposes, any mal

Dec 21, 2022

NaCL Pipe Go Package

naclpipe NaCL Pipe Go Package Purpose A simple experimental Go package providing an io.Reader/io.Writer interface with an NaCL (pronounced 'Salt') cry

Sep 27, 2022

Xendit package usage for development purpose

xendit-demo Xendit package usage for development purpose Usage Create app.env file on your root folder. Add 'READ_KEY_XENDIT' and 'WRITE_KEY_XENDIT' v

Dec 15, 2021

Golang package for reading FoxPro DBF/FPT files.

Golang package for reading FoxPro DBF/FPT files.

go-foxpro-dbf Golang package for reading FoxPro DBF/FPT files. This package provides a reader for reading FoxPro database files. At this moment it is

Sep 23, 2022

This package provides the following capabilities for managing and installing the WebView2

WebView2Runtime This package provides the following capabilities for managing and installing the WebView2 runtime: Retrieve version of installed WebVi

Aug 1, 2022

Conc - A package to help with concurrent operations in Go

conc Conc is a package to help with concurrent operations in Go. Works with Go1.

Jan 18, 2022

CLI client (and Golang module) for deps.dev API. Free access to dependencies, licenses, advisories, and other critical health and security signals for open source package versions.

CLI client (and Golang module) for deps.dev API. Free access to dependencies, licenses, advisories, and other critical health and security signals for open source package versions.

depsdev CLI client (and Golang module) for deps.dev API. Free access to dependencies, licenses, advisories, and other critical health and security sig

May 11, 2023
Comments
  • Create `FindAll` function

    Create `FindAll` function

    Provides a function that retrieves a map and function predicate then returns a slice of all values that match the predicate.

    The proposed API is as below

    m := map[int]int{ 1:1, 2:2, 3:3 }
    predicate := func (k int, v int) bool { return v > 1 }
    
    values := gomap.FindAll(m, predicate)
    
    fmt.Println(values) // [2,3]
    

    The order of the results is ignored.

  • Create `Clear` function

    Create `Clear` function

    Provide a function to clear map values with a map as input. The function should iterate the map key and value and call delete(map, key) function.

    The proposed API is as below

    m := map[int]int{ 1:1, 2:2 }
    
    gomap.Clear(m)
    
  • Create examples

    Create examples

    Make examples of the use of each function, with a list of functions as follows:

    • [x] Keys
    • [x] Values
    • [x] Find
    • [x] Reduce
    • [x] Filter
    • [x] Combine
    • [x] Map
    • [x] Every
    • [x] Some
    • [x] Equal
    • [x] EqualFunc

    Examples should be placed in the examples/function_name/function_name.go.

Related tags
WIP. Converts Azure Container Scan Action output to SARIF, for an easier integration with GitHub Code Scanning

container-scan-to-sarif container-scan-to-sarif converts Azure Container Scan Action output to Static Analysis Results Interchange Format (SARIF), for

Jan 25, 2022
This repo contains golang implementation of common DSA problems

DSA This repo contains golang implementation of common DSA problems Trees Tree T

Jan 10, 2022
lolcat in Go that's not broken Ruby that doesn't work with figlet

lolcat in Go Yeah, no one wants to install Ruby just to use lolcat in 2021. This one actually works with combined with future figlet font. (The other

May 15, 2021
Golang library to make sandboxing AppImages easy

aisap AppImage SAndboxing Project: a Golang library to help sandbox AppImages with bwrap What is it? aisap intends to be a simple way to implement And

Nov 16, 2022
A light package for generating and comparing password hashing with argon2 in Go

argon2-hashing argon2-hashing provides a light wrapper around Go's argon2 package. Argon2 was the winner of the Password Hashing Competition that make

Sep 27, 2022
Argon2 password hashing package for go with constant time hash comparison

argon2pw Argon2 password hashing package with constant time hash comparison Preface: Argon2 was selected as the winner of the Password Hashing Competi

Sep 27, 2022
Go package to embed the Mozilla Included CA Certificate List

rootcerts Package rootcerts provides an embedded copy of the Mozilla Included CA Certificate List, more specifically the PEM of Root Certificates in M

Oct 21, 2022
Package for controlling the Windows firewall (aka Windows Filtering Platform, WFP)

wf What This is a package for controlling the Windows Filtering Platform (WFP), also known as the Windows firewall. See its docs: https://godoc.org/in

Dec 6, 2022
Package csrf is a middleware that generates and validates CSRF tokens for Flamego

csrf Package csrf is a middleware that generates and validates CSRF tokens for Flamego.

Nov 25, 2022