code.gitea.io/gitea@v1.21.7/services/forms/package_form.go (about) 1 // Copyright 2022 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package forms 5 6 import ( 7 "net/http" 8 9 "code.gitea.io/gitea/modules/context" 10 "code.gitea.io/gitea/modules/web/middleware" 11 12 "gitea.com/go-chi/binding" 13 ) 14 15 type PackageCleanupRuleForm struct { 16 ID int64 17 Enabled bool 18 Type string `binding:"Required;In(alpine,cargo,chef,composer,conan,conda,container,cran,debian,generic,go,helm,maven,npm,nuget,pub,pypi,rpm,rubygems,swift,vagrant)"` 19 KeepCount int `binding:"In(0,1,5,10,25,50,100)"` 20 KeepPattern string `binding:"RegexPattern"` 21 RemoveDays int `binding:"In(0,7,14,30,60,90,180)"` 22 RemovePattern string `binding:"RegexPattern"` 23 MatchFullName bool 24 Action string `binding:"Required;In(save,remove)"` 25 } 26 27 func (f *PackageCleanupRuleForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { 28 ctx := context.GetValidateContext(req) 29 return middleware.Validate(errs, ctx.Data, f, ctx.Locale) 30 }