예제 #1
0
파일: manager.go 프로젝트: postfix/skizze
/*
GetCountForDomain ...
*/
func (m *ManagerStruct) GetCountForDomain(domainID string) (interface{}, error) {
	var val, ok = m.domains[domainID]
	if ok == false {
		return 0, errors.New("No such domain: " + domainID)
	}
	var counter abstract.Counter
	counter = val.(abstract.Counter)
	count := counter.GetCount()
	return count, nil
}
예제 #2
0
파일: manager.go 프로젝트: postfix/skizze
/*
DeleteFromDomain ...
*/
func (m *ManagerStruct) DeleteFromDomain(domainID string, values []string) error {
	var val, ok = m.domains[domainID]
	if ok == false {
		return errors.New("No such domain: " + domainID)
	}
	var counter abstract.Counter
	counter = val.(abstract.Counter)

	bytes := make([][]byte, len(values), len(values))
	for i, value := range values {
		bytes[i] = []byte(value)
	}
	ok, err := counter.RemoveMultiple(bytes)
	return err
}