-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmap2.go
More file actions
29 lines (24 loc) · 790 Bytes
/
map2.go
File metadata and controls
29 lines (24 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
package core
type map2 map[[2]string]Instance
func NewMap2() map2 {
return map[[2]string]Instance{}
}
func (s map2) Get(key1, key2 Instance) (Instance, bool) {
if v, ok := s[[2]string{key1.String(), key2.String()}]; ok {
return v, true
}
return nil, false
}
func (s map2) Set(key1, key2, value Instance) {
s[[2]string{key1.String(), key2.String()}] = value
}
func (s map2) Delete(key1, key2 Instance) (Instance, bool) {
if v, ok := s[[2]string{key1.String(), key2.String()}]; ok {
delete(s, [2]string{key1.String(), key2.String()})
return v, true
}
return nil, false
}