A dot notation compatible concurrent-safe golang hashmap
<img alt=dotmap Logo” src=”./readme/default.png” width=”auto” />
A Dot notation compatible concurrent safe Hashmap in pure Go
package main
import (
"fmt"
"github.com/zerjioang/dotmap"
)
func main(){
mm := dotmap.New()
mm.Reset(map[string]interface{}{
"foo": "bar",
"enableDebug": false,
"version": 1.0,
"config": map[string]interface{}{
"http": 2,
},
})
v, found := dotmap.GetDotMap(mm, "config.http")
fmt.Println("key found: ", found)
fmt.Println("key value: ", v)
v2, found2 := dotmap.GetDotMap(mm, "config.key")
fmt.Println("key found: ", found2)
fmt.Println("key value: ", v2)
}
and prints in terminal std out:
key found: true
key value: 2
key found: false
key value: <nil>
All rights reserved to @zerjioang under GNU GPL v3 license
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.