feat: 增加网站创建功能

This commit is contained in:
zhengkunwang223
2022-10-28 17:04:57 +08:00
committed by zhengkunwang223
parent a1ac689a5e
commit ef789cdfea
60 changed files with 1156 additions and 70 deletions

View File

@@ -48,3 +48,19 @@ func (b *Block) AddDirectives(directive Directive) {
directives := append(b.GetDirectives(), &directive)
b.Directives = directives
}
func (b *Block) RemoveDirectives(names []string) {
nameMaps := make(map[string]struct{}, len(names))
for _, name := range names {
nameMaps[name] = struct{}{}
}
directives := b.GetDirectives()
var newDirectives []IDirective
for _, dir := range directives {
if _, ok := nameMaps[dir.GetName()]; ok {
continue
}
newDirectives = append(newDirectives, dir)
}
b.Directives = newDirectives
}