Files
BiliDown/internal/util/field.go
T
yw1573 dd8eaef97d refactor: restructure project to standard Go layout
- Reorganize code into cmd/bilidown and internal/ packages
- Rename client/ to web/ for frontend source
- Remove systray dependency for headless web service
- Embed static files into binary using go:embed
- Update import paths to use internal/ prefix
- Update .gitignore with common patterns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 17:21:49 +08:00

37 lines
733 B
Go

package util
type FieldUtil struct{}
func (f FieldUtil) AllowSelect() []string {
return []string{
"download_folder",
}
}
func (f FieldUtil) AllowUpdate() []string {
return []string{
"download_folder",
}
}
func (f FieldUtil) IsAllow(allFields []string, names ...string) bool {
allowedFields := make(map[string]struct{})
for _, field := range allFields {
allowedFields[field] = struct{}{}
}
for _, name := range names {
if _, exists := allowedFields[name]; !exists {
return false
}
}
return true
}
func (f FieldUtil) IsAllowSelect(names ...string) bool {
return f.IsAllow(f.AllowSelect(), names...)
}
func (f FieldUtil) IsAllowUpdate(names ...string) bool {
return f.IsAllow(f.AllowUpdate(), names...)
}