File: generic_simplemap.go

package info (click to toggle)
golang-github-cheekybits-genny 1.0.0-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid
  • size: 336 kB
  • sloc: makefile: 17; sh: 3
file content (22 lines) | stat: -rw-r--r-- 445 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package multipletypes

import "github.com/cheekybits/genny/generic"

type KeyType generic.Type
type ValueType generic.Type

type KeyTypeValueTypeMap map[KeyType]ValueType

func (m KeyTypeValueTypeMap) Has(key KeyType) bool {
	_, ok := m[key]
	return ok
}

func (m KeyTypeValueTypeMap) Get(key KeyType) ValueType {
	return m[key]
}

func (m KeyTypeValueTypeMap) Set(key KeyType, value ValueType) KeyTypeValueTypeMap {
	m[key] = value
	return m
}