Files
gf/g/container/gmap/gmap.go

45 lines
1.8 KiB
Go
Raw Normal View History

// Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved.
2018-01-03 10:38:53 +08:00
//
// This Source Code Form is subject to the terms of the MIT License.
2019-02-01 17:30:23 +08:00
// If a copy of the MIT was not distributed with gm file,
// You can obtain one at https://github.com/gogf/gf.
2018-01-03 10:38:53 +08:00
// Package gmap provides concurrent-safe/unsafe map containers.
2018-01-03 10:38:53 +08:00
package gmap
// Map based on hash table, alias of AnyAnyMap.
2019-06-19 09:06:52 +08:00
type Map = AnyAnyMap
type HashMap = AnyAnyMap
// New returns an empty hash map.
2019-06-11 20:57:43 +08:00
// The parameter <unsafe> used to specify whether using map in un-concurrent-safety,
// which is false in default, means concurrent-safe.
func New(unsafe ...bool) *Map {
return NewAnyAnyMap(unsafe...)
}
// NewFrom returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
2019-06-11 20:57:43 +08:00
// The parameter <unsafe> used to specify whether using tree in un-concurrent-safety,
// which is false in default.
2019-06-19 09:06:52 +08:00
func NewFrom(data map[interface{}]interface{}, unsafe ...bool) *Map {
return NewAnyAnyMapFrom(data, unsafe...)
2019-05-09 22:53:42 +08:00
}
// NewHashMap returns an empty hash map.
2019-06-11 20:57:43 +08:00
// The parameter <unsafe> used to specify whether using map in un-concurrent-safety,
// which is false in default, means concurrent-safe.
func NewHashMap(unsafe ...bool) *Map {
return NewAnyAnyMap(unsafe...)
}
// NewHashMapFrom returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
2019-06-11 20:57:43 +08:00
// The parameter <unsafe> used to specify whether using tree in un-concurrent-safety,
// which is false in default.
2019-06-19 09:06:52 +08:00
func NewHashMapFrom(data map[interface{}]interface{}, unsafe ...bool) *Map {
return NewAnyAnyMapFrom(data, unsafe...)
2019-06-19 09:06:52 +08:00
}