项目作者: zerjioang

项目描述 :
A dot notation compatible concurrent-safe golang hashmap
高级语言: Go
项目地址: git://github.com/zerjioang/dotmap.git
创建时间: 2020-05-12T12:09:52Z
项目社区:https://github.com/zerjioang/dotmap

开源协议:GNU General Public License v3.0

下载



<img alt=dotmap Logo” src=”./readme/default.png” width=”auto” />

dotmap


A Dot notation compatible concurrent safe Hashmap in pure Go






Latest release

Download

TL;DR

  1. package main
  2. import (
  3. "fmt"
  4. "github.com/zerjioang/dotmap"
  5. )
  6. func main(){
  7. mm := dotmap.New()
  8. mm.Reset(map[string]interface{}{
  9. "foo": "bar",
  10. "enableDebug": false,
  11. "version": 1.0,
  12. "config": map[string]interface{}{
  13. "http": 2,
  14. },
  15. })
  16. v, found := dotmap.GetDotMap(mm, "config.http")
  17. fmt.Println("key found: ", found)
  18. fmt.Println("key value: ", v)
  19. v2, found2 := dotmap.GetDotMap(mm, "config.key")
  20. fmt.Println("key found: ", found2)
  21. fmt.Println("key value: ", v2)
  22. }

and prints in terminal std out:

  1. key found: true
  2. key value: 2
  3. key found: false
  4. key value: <nil>

Licenses

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:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Uses GPLv3 license described below

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.