safemap

command module
v0.0.0-...-c348e6c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2017 License: MIT Imports: 8 Imported by: 0

README

Build Status Coverage Status Go Report Card GoDoc

safemap

An auto-generated thread-safe map package written in golang.

install

go get github.com/ggaaooppeenngg/safemap

usage

Run safemap -k Key_type -v Val_type to generate a file named Key_type2Val_type.go in currenty package directory. It will search currenty directory for the definitions of Key_type and Val_type, and define a struct Key_type2Val_typeSafeMap in the file. You can also use -n to specify a namespace instead of default Key_type2Value_type in order to avoid conflicts.

You can also use go generate to automatically generate the code, put a comment in your code like below and run go generate, a generated file will be found.

//go:generate safemap -k TypeKey -v TypeValue
type TypeKey string
type TypeValue string

or

//go:generate safemap -k string -v TypeValue -n prefix
type TypeValue string

Documentation

Overview

Package safemap is a package used to generate thread-safe map for general purpose. Run safemap -k K -v V will generate a K2VSafeMap in K2V_safemap.go for map implementation code, to avoid conflicts you can use -n to specify a namespace to generate a namespaceSafeMap in namespace_safemap.go. and run go doc you can get document of it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL