1.4.5.2
This commit is contained in:
27
EdgeDNS/internal/models/ns_keys.go
Normal file
27
EdgeDNS/internal/models/ns_keys.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package models
|
||||
|
||||
type NSKeys struct {
|
||||
m map[int64]*NSKey // keyId => *NSKey
|
||||
}
|
||||
|
||||
func NewNSKeys() *NSKeys {
|
||||
return &NSKeys{m: map[int64]*NSKey{}}
|
||||
}
|
||||
|
||||
func (this *NSKeys) Add(key *NSKey) {
|
||||
this.m[key.Id] = key
|
||||
}
|
||||
|
||||
func (this *NSKeys) Remove(keyId int64) {
|
||||
delete(this.m, keyId)
|
||||
}
|
||||
|
||||
func (this *NSKeys) All() []*NSKey {
|
||||
var result = []*NSKey{}
|
||||
for _, k := range this.m {
|
||||
result = append(result, k)
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user