3
0
Mumbi Francis 89f621c035 Add ability to select and perform bulk operations on all records
This change affects the recordlist and the bulk operations are edit,delete and undelete
2023-06-14 18:37:44 +03:00

43 lines
616 B
Go

package slice
import (
"bytes"
"strconv"
)
type (
// UInt64s represents slice of uint64 with some extra powers:
// - encodes (JSON) uint64s as strings
UInt64s []uint64
)
func HasUint64(ss []uint64, s uint64) bool {
for _, value := range ss {
if value == s {
return true
}
}
return false
}
func (uu UInt64s) MarshalJSON() ([]byte, error) {
var (
buf = bytes.Buffer{}
)
buf.WriteByte('[')
for i, u := range uu {
if i > 0 {
buf.WriteByte(',')
}
buf.WriteByte('"')
buf.WriteString(strconv.FormatUint(u, 10))
buf.WriteByte('"')
}
buf.WriteByte(']')
return buf.Bytes(), nil
}