A group of checkboxes for rendering multi-select ui, it can be useful for representing 'permission' or 'type' etc.
type Model struct {
Perm uint32 `paw:"bitmask" pawLabel:"Permission"`
}
// PermPawOptions is 'Perm'(field name) + 'PawOptions'
// this method will be called by paw.Gen to set options for 'Perm'
func (bm Model) PermPawOptions() []paw.BitMaskOption {
return []paw.BitMaskOption{
{Label: "Read", Value: 0b1},
{Label: "Write", Value: 0b10},
{Label: "Execute", Value: 0b100},
{Value: ^uint64(0)},
}
}
paw.Form{
Body: paw.Gen(m),
}
paw.Gen(m).BitMaskOptions(map[string][]paw.BitMaskOption{
"Perm": {
{Value: 0b100000},
{Value: 0b1000000},
},
})