mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-18 14:44:06 +09:00
Fix lint
This commit is contained in:
@ -29,17 +29,18 @@ func (err ErrSecretDataInvalid) Error() string {
|
||||
|
||||
var nameRE = regexp.MustCompile("[^a-zA-Z0-9-_.]+")
|
||||
|
||||
// Secret represents a secret
|
||||
type Secret struct {
|
||||
ID int64
|
||||
UserID int64 `xorm:"index"`
|
||||
RepoID int64 `xorm:"index"`
|
||||
Name string
|
||||
Data string
|
||||
PullRequest bool
|
||||
ID int64
|
||||
UserID int64 `xorm:"index"`
|
||||
RepoID int64 `xorm:"index"`
|
||||
Name string
|
||||
Data string
|
||||
PullRequest bool
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"created"`
|
||||
}
|
||||
|
||||
// Validate validates the required fields and formats.
|
||||
// Validate validates the required fields and formats.
|
||||
func (s *Secret) Validate() error {
|
||||
switch {
|
||||
case len(s.Name) == 0:
|
||||
|
@ -41,7 +41,7 @@ func FindObjects[Object any](ctx context.Context, cond builder.Cond, opts *ListO
|
||||
if opts.Page < 1 {
|
||||
opts.Page = 1
|
||||
}
|
||||
sess.Limit(opts.PageSize, opts.PageSize * (opts.Page - 1))
|
||||
sess.Limit(opts.PageSize, opts.PageSize*(opts.Page-1))
|
||||
}
|
||||
return sess.Find(objects)
|
||||
}
|
||||
|
25
models/migrations/v227.go
Normal file
25
models/migrations/v227.go
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func createSecretsTable(x *xorm.Engine) error {
|
||||
type Secret struct {
|
||||
ID int64
|
||||
UserID int64 `xorm:"index"`
|
||||
RepoID int64 `xorm:"index"`
|
||||
Name string
|
||||
Data string
|
||||
PullRequest bool
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"created"`
|
||||
}
|
||||
|
||||
return x.Sync(new(Secret))
|
||||
}
|
Reference in New Issue
Block a user