safemap

Auto generated thread-safe map written in golang.

2 years after

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

Related Repositories

boon

boon

Simple opinionated Java for the novice to expert level Java Programmer. Low Cer ...

goeg

goeg

Source code for the book Programming in Go: Creating Applications for the 21st C ...

safemap.js

safemap.js

A tiny, safe, ES3-compliant map/dictionary implementation in JavaScript. ...

go-codegen

go-codegen

Go repos for code generation ...